This article presents the steps to generate and download work orders with the Scantrust API. The UAT token needs to have access to the following permissions:
scans_download
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: the "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 Download Scan Data:
1. To download your Scan Data, you need to:
- Find the campaign ID
- Set the timeframe to filter the scans, based on a time range.
How to find your Campaign ID:
- Log on to the portal and click on CAMPAIGNS in the left hamburger menu
- On the campaign for which you want to download the data, click the DASHBOARD icon
- When the dashboard opens, the URL in the browser will show:
https://portal.scantrust.com/#/dashboard?tabIndex=0&campaignId=126&page=1
- The campaign-id needed is in the parameter campaign ID
2. Then you need to filter the information you want to download. All of the filters used in the dashboard can also be used to filter the scans downloaded. For example, you want to filter and download all scans for campaign 195 which were flagged out-of-market and which have intended_market set to "China" (Zh). To achieve this, you must set a GET request with the following URL, as follows: https://api.scantrust.com/api/v2/dashboard/scans/?campaign=195&flags=out-of-market&limit=2000&offset=0&scm_intended_market=zh&timeframe=-1m
2. Then, you should get a 200 OK response:
3. On the response,
Comments