Barcode Xpress for Linux v13.9 - Updated
Barcode Scanner REST API
API Reference > Barcode Scanner REST API

Introduction

The Barcode Scanner REST API allows your application to take a source document as input and produce a list of scanned barcodes as output.

Available URLs

URL Description
POST https://api.accusoft.com/barcode/api/v1/scanners Creates and starts a new barcode scanner process.
GET https://api.accusoft.com/barcode/api/v1/scanners/{processId} Gets the state of an existing barcode scanner process.

Getting Started

The following topic contains an explanation of how to get started using the Barcode Scanner REST API and includes sample code for interacting with the service in C#.

POST /barcode/api/v1/scanners

Creates and starts a new barcode scanner process.

A barcode scanner represents a process that runs on the server and creates a list of scanned barcodes.

The server process to scan barcodes is started by this request, but a response is sent before the process is complete. Use the GET https://api.accusoft.com/barcode/api/v1/scanners/{processId} URL below to get the state and results of an in-progress or completed barcode scanner process.

A new barcode list containing the scanned barcodes will be created.

NOTES:

  1. The barcode scanner supports the following input file types:

    • TIFF
    • JPEG
    • PNG
  2. The barcode scanner works for single-page files. If the input file contains more than one page, it will scan the first page and ignore the rest.

Request

Request Headers

Name Description
Content-Type Must be application/json

Request Body

JSON object conforming to the following:

Successful Response

Response body

JSON object with the following properties:

Error Responses

Status Code JSON errorCode Description
480 "MissingInput" A required input value was not provided. See errorDetails in the response body.
480 "InvalidInput" An invalid input value was used. See errorDetails in the response body.
480 "UnrecognizedInput" An unrecognized JSON property was provided. See errorDetails in the response body.
480 "ResourceNotFound" Source document work file does not exist. See errorDetails in the response body.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

POST /barcode/api/v1/scanners
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    }
  },
  "minSecondsAvailable": 60
}

Response

HTTP 200 OK
Content-Type: application/json
{
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    }
  },
  "state": "processing"
}

GET /barcode/api/v1/scanners/{processId}

Gets the state and result of an existing barcode scanner process created by POST /barcode/api/v1/scanners.

Requests can be sent to this URL repeatedly while the state is "processing".

When the state is "complete", the response will include the list of scanned barcodes.

If the barcode scanner process encountered an error, the state property will be "error" and the errorCode property will contain an error code string.

Request

Parameters

Parameter Description
{processId} The id of the barcode scanner process.

Response body

JSON object with the following properties:

Error Responses and JSON Error Codes

Status Code JSON errorCode Description
404 "ResourceExpired" Barcode scanner process specified by {processId} has expired.
404 "ResourceNotFound" Barcode scanner process specified by {processId} could be found.
200 "UnsupportedFileFormat" The file format of the provided source document is not supported.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

GET /barcode/api/v1/scanners/iFhSZRvrz2vtFjcTSi9Qlg

Successful Response

When the barcode scanner process completes with no errors:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "state": "complete",
  "output": {
    "barcodes":
    [
      {
        "area": 
        {
            "x": 496,
            "y": 81,
            "width": 646,
            "height": 99
        },        
        "barcodeDataAsBytes": "NDQxMjMxMjM0NTYxMjM0NTY3KiogVU5MSUNFTlNFRCBhY2N1c29mdC5jb20A",
        "barcodeType": "intelligentMail",
        "barcodeValue": "44123123456123456789"       
        "confidence": 100,
        "numberCheckSumChars": 0,
        "point1": 
        {
            "x": 496,
            "y": 81
        },
        "point2": 
        {
            "x": 496,
            "y": 81
        },
        "point3": 
        {
            "x": 496,
            "y": 81
        },
        "point4": 
        {
            "x": 496,
            "y": 81
        },
        "skew": 0,
        "validCheckSum": true           
      }
    ]
  }
}

Error responses

Response when a barcode scanner process does not exist for the given processId:

HTTP 404
Content-Type: application/json
{
  "errorCode": "ResourceNotFound",
  "errorDetails": {
    "in": "url",
    "at": "processId",
  },
}

Response when a barcode scanner process did exist for the given processId, but has passed its expiration time:

HTTP 410
Content-Type: application/json
{
  "errorCode": "ResourceExpired",
  "errorDetails": {
    "in": "url",
    "at": "processId",
  },
}

Response when source document is a file format that is not supported by the barcode scanner:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "UnsupportedFileFormat",
  "errorDetails": {
    "in": "process",
    "at": "input.source.fileId"
  },
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}

Is this page helpful?
Yes No
Thanks for your feedback.