Scanning
The Scanning API is also a RESTful endpoint residing on the target terminal, however it consists solely of GET requests with appropriate parameters as detailed below. Furthermore, the API is intended to capture barcode and QR code data ONLY and will return this data as a Base64 encoded string.
/scan API Request
URL
https://(TerminalIP):8080/POSitiveWebLink/1.1.0/rest/scan
An HTTPS GET
request should be sent to the above URL with the following parameters:
POST /scan - Query String Parameters | |||
---|---|---|---|
Field Name | State | Data Type | Description |
tid | Mandatory | String | This is the Serial Number of the terminal that should print the request. This is printed on a label on the rear of the device. |
preferFrontCamera | Optional | Boolean | Determines whether the scanner should use the Front Camera (if available). Set to true to use the front-facing camera. Default = false. |
timeoutSec | Optional | Integer | Determines how long in seconds to wait for the scanner before cancelling the request. Default = 60 seconds. |
POST /transaction - Header Parameters | |||
Authorization | Mandatory | String | This field should be populated with a value of Bearer 6945595921271780 |
Example Request
GET https://192.168.0.101:8080/POSitiveWebLink/1.1.0/rest/scan?tid=1760011990&preferFrontCamera=false&timeoutSec=20
/scan API Response
If properly formatted, you will receive a 200
HTTP response with the following fields:
GET /scan - Response | ||||||||
---|---|---|---|---|---|---|---|---|
Field Name | Data Type | Description | ||||||
resultCode | Integer | The outcome of the Scan attempt. Can be one of the following values:
| ||||||
data | String | Base64 encoded barcode/QR results. In the event of an unsuccessful scan, this field will be "null". |
Example Responses
- Successful QR Code
- Successful Barcode
- Timeout
- Cancelled
{
"resultCode": 1,
"data": "aHR0cHM6Ly9kZXZlbG9wZXIuZG5hcGF5bWVudHMuY29tLw=="
}
{
"resultCode": 1,
"data": "MTIzNDU2Nzg5MTAxOQ=="
}
{
"resultCode": 2,
"data": "null"
}
{
"resultCode": 3,
"data": "null"
}
note
Both QR codes and Barcodes are returned as base64 encoded strings.