Usage

bcod.es read API allows you to decode from local files or URLs.

Request
$ curl read.bcod.es/CODE128 -F 'image=@PATH_TO_FILE.PNG'

Send a POST request containing the path to your local file. Specify the codes format in the URL.

$ curl read.bcod.es/CODE128/http://show.bcod.es/CODE128/123-456-789.png

You can decode images from URLs, if you pass it as second parameter in GET requests.

Response
{
"success"true,
"value": "123-456-789",
"height": 200,
"width": 200,
"fileType": "png"
}

Examples

CODE128

Request
$ curl -F 'image=@PATH' read.bcod.es/CODE128
Response
{
"success"true,
"value": "123-456-789",
"height": 142,
"width": 332,
"fileType": "png"
}

EAN13

Request
$ curl -F 'image=@PATH' read.bcod.es/EAN13
Response
{
"success"true,
"value": "234567890128",
"height": 142,
"width": 234,
"fileType": "png"
}

Errors

Invalid format

Provided a format that is not available to decode.
Valid formats for now are:

  • CODE128
  • CODE39
  • CODE93
  • CODABAR
  • EAN8
  • EAN13
Request
$ curl -F 'image=@PATH' read.bcod.es/WRONG-FORMAT
Response
{
"success"false,
"error": "Invalid format",
}

Empty value

Decoding worked, but the value returned was empty.
It was probably not the right format for this type of code.

Request
$ curl -F 'image=@CODE128-IMAGE' read.bcod.es/CODE39
Response
{
"success"false,
"error": "Empty value",
}

Could not find MIME for Buffer

Resource behind provided link is most likely not a valid image type.

Request
$ curl read.bcod.es/CODE128/http://show.bcod.es/
Response
{
"success"false,
"error": "Could not find MIME for Buffer <null>",
}