Getting Started
The Scantrust Admin Rest API is the default way in which all the apps, portal and mobile landing pages communicate with the backend. In order to access this API, developers need to obtain the following:
- A valid activated company account on the Scantrust Enterprise Portal
- A user within that company with sufficient access rights to access the required information. Typically this will be a user with at least the SCM User Role in order to do SCM uploads, but other configurations with different access rights are also available (SCM Admin, Brand Manager etc.).
- That user must then create a User Authorization token. Using a User Authorization Token is recommended as it gives fine-grained control over what in information can be accessed by the automation.
- This User Authorization token must then be used for all requests to the REST API.
Endpoint and Features
The public-facing REST API endpoints can be accessed at https://api.staging.scantrust.io/ for testing. For production, use https://api.scantrust.com/.
The admin api can be used for several common use-cases:
- Creating Products and assigning codes to those products
- Updating other code-information such as serial number and activation status
- Assign data to SCM fields to enable track and trace
- Generating Codes with Work Orders
- Upload your own custom codes
- Download Scan Data
- Download Code data (of activated / blacklisted codes)
Network details
For more restricted enterprise environments, see the Network Access Details on how to configure the appropriate network access.
Code examples
We have also included one Javascript code example to get you started:
Should you need other samples, please contact support to ask one of our friendly developers for help. :)
Error handling
All implementations need to take care of handling the following HTTP error codes:
Sure, below are the recommended handling by the REST client program for each of these HTTP response codes:
HTTP Response Code | Summary | Handling by REST Client Program |
---|---|---|
200 | The request was successful | Parse and utilize the data received in the response by the program. |
201 | The request was successful and a new resource was created | Parse and utilize the data received in the response by the program, and then us the newly created objectaccordingly. |
400 | The request was malformed or invalid | Handle the error scenario as returned in the body of the error message. Log and inform the admin to correct the request. It's important to note that the 400 returns a BODY which states the reason of the error. Logging this is important in troubleshooting. Also note that Scantrust records these 400 errors and you can contact Scantrust Support to get further information why your request was invalid |
401 | Authentication credentials of the the UAT token in the request header were missing or incorrect | Handle the error scenario in the program, log and report to the admin to update the UAT token with valid credentials in the request header. |
403 | The user does not have sufficient permissions to access the requested resource | Handle the error scenario in the program and contact the administrator to check the UAT token validity and access rights in the program. |
404 | The requested resource could not be found on the server | Handle the error scenario in the program and prompt the user to check their input parameters or retry the request later. |
429 | The user has exceeded a rate limit | Handle the error scenario in the program and wait until the retry-after interval given in the response header then retry the request. |
500 | An error occurred on the server while processing the request | Handle the error scenario in the program, log and notify the administrator or retry the request later. |
503 | The server is currently unavailable | Handle the error scenario in the program and log and notify the administrator to retry the request later. |