Transportation & Cargo API Reference
API URL: http(s)://<your-host>/transport/[type]
Where [type] is the type of code to read in the uploaded images:
| Type | Parameter Value |
|---|---|
| European wagon and locomotive codes used across Europe to identify individual rail vehicles | eu-rail |
| American wagon and locomotive codes used across the American continent to identify individual rail vehicles | am-rail |
| Identification codes used on trucks (ACCR, US DOT, Chassis) | truck |
| ISO codes for containers and identification of intermodal loading units (ILU) | iso |
To use the API, make an HTTP POST request the endpoint found above.
See below for the required and optional parameters and possible responses.
/{type+}
POST
Description
The content type of the POST request must be in 'multipart/form-data' format, and its size in bytes must not exceed the value specified in the CarmenWorkerMaxFileSize environment variable.
See below for the required and optional parameters and possible responses.
Parameters
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| x-disable-checksum-check | header | The codes the engine can recognize contain a checksum digit which can be used to check the validity of the digits read. A matching checksum indicates a high probability of the recognition result being correct. The Transportation & Cargo API verifies the checksum by default and discards any results where the check fails. By sending true as the value of this header, you can disable this check and receive all codes the engine recognized - even those known to be incorrect. | No | string |
| x-disable-iso-code | header | Disables searching for and reading the last 4 digits of the ISO container code. NOTE: This parameter is only used when using the iso code type, when searching for other code types, it has no effect. | No | string |
| x-enable-full-us-accr-code | header | Enables full US ACCR code recognition. NOTE: This parameter is only used when using the accr_usa code type, when searching for other code types, it has no effect. | No | string |
| x-enable-wide-range-analysis | header | If you cannot guarantee that the uploaded image meets all the required parameters (see the Input Images tab on the How To Use page), you can turn on the wide-range analysis by setting this header's value to true. Attention! The duration of the analysis may increase several times. | No | string |
| x-disable-image-resizing | header | The service resizes large images to Full HD resolution by bicubic interpolation. Resizing can make reading many times faster, but it can reduce the recognition efficiency. If you don't want the service to resize your images, turn this feature on by setting the header value to true. By disabling image resizing, you may also need to enable wide range analysis. | No | string |
| type | path | The type of code to read in the uploaded images. | Yes | string |
| Request | body | A multipart/form-data request which contains input images and configuration parameters for a Transport API call. | Yes | Request |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | The HTTP 200 OK success status response code indicates that the request has succeeded. The response will contain a result in JSON format. | Response |
| 400 | Invalid Image. Recognition can not initiate without a proper image. Please check image input guide for proper input images. | Error |
| 401 | You are unauthorized to access the requested resource. An API key is missing. Your API KEY can be found on the ANPR Cloud Dashboard's 'how to use' page. | Error |
| 403 | Invalid API Key! Your account is not authorized to access the requested resource. Your API KEY may have changed. Please check the validity of your API key in the Cloud Dashboard. | Error |
| 405 | This method type is not currently supported. Only the POST method is allowed for ANPR Cloud SaaS. | Error |
| 408 | Timeout occured. | Error |
| 413 | The requested entity (image's size) is larger than the server is willing or able to process. Please check the image input guide to our maximum image size in MB. | Error |
| 429 | Limit exceeded, or throttled request. Please subscribe to our service through which your free lookups are redeemable. | Error |
| 500 | Unexpected internal server error. | Error |
| 503 | The server is currently unavailable. Due to 'queue full' error, cannot process the request. | Error |
| 504 | No timely response received from upstream server serving as a gateway or proxy. | Error |
Models
Request
The request body has to include the binary content of the images to be examined. Optionally, it can include the maximum number of reads to be performed (maxreads).
- image: (binary or base64 string) the binary data (as base64-encoded string or as a binary file content) of the pictures you would like to analyze. To upload multiple pictures, add the
imageparameter to your request multiple times. - maxreads: (integer) an optional parameter, it specifies the maximum number of code searches per image sequence. Use this parameter carefully, because every search increases the processing time. The system will stop searching when there is no more code in the image, or the number of searches reaches the value of maxreads. Its value is 1 by default.
Response
If the service call is successful, the service will return a Response json object.
Response structure
- data: (Data structure) includes recognition results.
- nodename: (string) the name of the node this request has been processed by. This is diagnostic information to be included in error reports.
- nodetime: (number) total processing time spent on the worker node (this includes processing, image loading and latency).
- version: (string) version of the JSON response format. Incremented each time the response structure changes.
Data structure
Includes recognition results.
- codes: (array of Code structures) an array containing all codes recognized on the images uploaded.
Code structure
An array containing all codes recognized on the images uploaded.
- code: (string) the code as a string.
- confidence: (integer, min: 0, max: 100) the estimated probability of the recognized code being correct as a percentage between 0 and 100.
- imageResults: (array of Image result structures) an array in which each item corresponds to one image uploaded. The items are objects that describe the recognition results found on their respective input images.
Image result structure
Includes the recognition results found on the given input image.
- found: (boolean) a boolean indicating whether a code has been found on the image.
- text: (string) the code found on the image as a string.
- confidence: (integer, min: 0, max: 100) the estimated probability of the recognized code being correct as a percentage between 0 and 100.
- characters: (Character structure) an array of objects which describe each character of the recognized code.
Character structure
Describes a single character recognized on the picture.
- code: (number) the numeric code of the character.
- bgDark: (boolean) a boolean indicating whether the background is darker than the character found.
- bgColor: (Color structure) the background color of the character.
- color: (Color structure) the color of the character.
- confidence: (integer, min: 0, max: 100) the estimated probability of the recognized character being correct as a percentage between 0 and 100.
- charROI: (ROI structure) the quadrangle (not necessarily a rectangle) where the character has been found (see (ROI structure)).
Color structure
Represents an RGB color.
- r: (number, min: 0, max: 255) the red component of the color.
- g: (number, min: 0, max: 255) the green component of the color.
- b: (number, min: 0, max: 255) the blue component of the color.
ROI structure
Describes the coordinates of a Rectangle of Interest, giving the coordinates of all four corners.
- topLeft: (Coordinate structure) the top left corner of the rectangle.
- topRight: (Coordinate structure) the top right corner of the rectangle.
- bottomLeft: (Coordinate structure) the bottom left corner of the rectangle.
- bottomRight: (Coordinate structure) the top right corner of the rectangle.
Coordinate structure
Represents a point on the Cartesian plane.
- x: (number) x coordinate.
- y: (number) y coordinate.
Error
The message property of the json response will describe the error.