This article presents the steps to generate and download work orders with the Scantrust API. Codes can be generated as a work order in two ways: Generating Serialized Identifiers (SID) work orders, these work orders are Scantrust QR codes without the secure graphic. The brand owner can self-generate and download these work orders and they do not require a printing partner.
On the other hand, Generating Scantrust Secure Codes (SSC) work orders: these work orders contain the copy-protection secure graphic and require a printing partner with calibrated equipment and substrate. These work orders are generated using a work order template which is set up by one of the Scantrust Engineers during the project implementation.
To generate any of those, you will need a UAT token with the following permissions:
- workorder_view
- workorder_create
- workorder_edit
- workorder_cancel
- workorder_archive
Important:
To get access to the Scantrust REST API, you can use an API platform such as Postman, this is the world's most popular API platform, with over 17 million users and 500,000 organizations worldwide. The tool comes with a flexible, and collaborative environment that allows you to design, develop, document, and test your APIs faster.
You can try the web application or download and install this app from this link: https://www.postman.com/downloads/. In any case, you must sign up with a valid email address.
Note: In the Scantrust context, Postman should be used only for testing purposes. It should not be intended to use on real scenarios or project implementations.
Steps to configure Postman:
1. Please open Postman, in the home page you should be able to see the following:
2. Then, please on the tap labeled: “Workspaces”, in the upper left corner:
3. Then, please click on the option labeled: “My workspace”:
4. Once you are in your workspace, please click on the “+” sign as follows:
5. After that, a new tab will appear with a preconfigured API request: GET:
6. Now, it is important to set up the API Authorization, to do that, please click on the tab labeled as: “Authorization”:
7. Then, click on the "Type" section and select: "API Key" option, as follows:
8. Now, type the word: "Authorization" on the key field, then copy your UAT token from the ST portal and paste it into the field labeled as: “Value”, including the characters UAT: UAT [your token], leaving a spacebar between the UAT string and the token:
9. Then, go to the “Body” tab, select “raw” and select “JSON”:
Steps to generate a SID work order:
1. At this point, you are ready to generate a SID work order. For the first step, you must change the API request to POST. Please click on the request button and select the “POST” option:
2. To set up this request you must type the URL, which in this case is the following: https://api.scantrust.com/api/v2/workorders/create-sid:
3. Then, on the body tab, please write the following:
{
"activate_on_complete":false,
"reference":"REF-001", - Your reference
"remarks":"Generated for Customer X", - Your remarks
"quantity":100, - The codes quantity
"use_serial_number":true,
"url_prefix":"https://my-url.com/", - Your URL
"extended_id_style":"compact-12",
"product":"123456789" - Your Product SKU
"printing_partner":"1234" - Your Printer Partner ID
}
In which, the "activation_on_complete" refers to whether codes should be active immediately or not., the "reference" refers to the internal reference, and must be unique for the company, the "quantity" refers to the number of codes to be generated, and the "use_serial_number" which is a boolean field, false or true (default), if true, serial number are added. All of those are required fields to set the request.
On the other hand, the description field refers to a brief description of the product, the client URL, refers to a product URL that may be used to redirect codes if a campaign is not active for the product, and the image let you Include a product image, typically used on STC landing pages. If not set, the brand image will be used and the campaign which is the ID of an existing campaign in the company to which this product must be added. All of these are optional fields.
4. Once you finish your code script, we can click on the SEND button:
5. When a SID work order is successfully generated, a response looks as follows:
Additionally, the status response should be: 201 created
Steps to generate Secure Scantrust Identifiers (SSC) work order:
Obtaining SSC codes from the Scantrust system requires the same steps as SID work orders, however for SSC codes, the printing partner needs to generate the codes based on their printing equipment and substrate. In this case, the brand owner calls the create SG work order endpoint and retrieves the work order id:
1. Please, go to your workspace in postman and open a new tab with the “+” sign:
2. Then, go to the “Body” tab, and select “none”:
3. In order to create the order, it is recommended to first choose a template. so you must set up a GET request by typing the URL, which in this case is the following: https://api.scantrust.com/api/v2/workorders/templates:
4. Then, click on the SEND button:
5. When the API request was successful, the status response should be 200 OK:
This response includes all of the templates that are included in your company (count), with specific attributes such as name, substrates, template description, image, and some others.
6. Once you know the template you are going to use, you have to set a POST request by typing the URL, which in this case is the following: https://api.scantrust.com/api/v2/workorders/create-sg:
7. Then, on the body tab, please write the following script based on your data, this is just an example:
{
"product": "IPC-F42FEN-0280B",
"template": "500",
"quantity": "1",
"remarks": "remarks 1",
"activate_on_complete": false,
"extended_id_style": "compact-12",
"substrate": null,
"code_layout": "sg-outside",
"use_serial_number": true,
"is_hybrid": false,
"template_image": null,
"is_fp_serialized": false,
"is_static_print": false,
"static_unique_codes_quantity": "0",
"printing_partner": "7138"
}
The "quantity" refers to the number of codes to be generated, the "code_layout" refers to the code layout method: "sg-inside", "sg-outside" or "custom", the "printing_partner" refers to the company ID of the Printing Partner, and the "reference" which is an internal reference that must be unique for the company. All of those are required fields to set the request.
On the other hand, the product, template, substrate, etc, are all optional fields.
7. Once you finish your code script, we can click on the SEND button and check the request:
Comments