Create SSC Work Orders
Overview
Because the scantrust platform is built to serve large numbers of codes, new codes are created asynchronously (in the background) and can be downloaded as a zip archive. (see Downloading Workorders section).
This page describes the SSC workorder creation.
SSC workorders contain the copy-protection secure graphic and require a printing partner with calbrated equipment and substrate. These workorders are generated using a workorder template which is set up by one of the Scantrust Engineers during the project implementation.
UAT token permissions
The UAT token needs to have access to the following permissions:
- workorder_view
- workorder_create
- workorder_edit
- workorder_cancel
- workorder_archive
The UAT token must be set in the header fields of all requests as described in Authentication & Tokens.
Worklflow
For SSC codes, the printing partner needs to generate/confirm the codes based on their printing equipment and substrate:
- Brand Owner: Call the create SG workorder endpoint and retrieve the workorder id
- Printing Partner: confirm the workorder and generate the codes
- Brand Owner: Query the search workorder endpoint to verify the workorder has the state
completed
as well as thecodegen_file
download-link is available - Brand Owner: Call the download workorder file endpoint to download the codes and their images.
Proceed to the (Downloading Workorders section)) for more information on the file content(s).
API Design - Create SSC Workorder
GET /api/v2/workorders/templates/
Get all available workorder templates and their attributes. To create an SG workorder, it is recommended to first choose a template.
Response (200): OK
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 164,
"name": "SG_Template_1",
"description": "n.a.",
"company": 6091,
"custom_layout": null,
"substrate": null,
"substrate_name": "",
"printing_partner": null,
"image": null,
"code_layout": "sg-outside",
"use_serial_number": true,
"is_hybrid": true,
"is_fp_serialized": false,
"is_static_print": false,
"is_archived": false,
"activate_on_complete": false,
"url_prefix": "",
"extended_id_style": "legacy",
"partner_permissions": []
}
]
}
POST /api/v2/workorders/create-sg/
Attribute | Required? | Description |
---|---|---|
product | optional | string, Scantrust product SKU used for these codes. |
template | optional | integer, retrieved from id in the above GET template request |
quantity | required | integer, number of codes to be generated |
remarks | optional | string, description of this workorder |
activate_on_complete | optional | false (default) or true, whether codes should be active immediately or not. |
extended_id_style | optional | "compact-12" or "legacy", see Extended ID (default: legacy) |
substrate | optional | integer, substrate id (default: null) |
code_layout | required | string, code layout method, "sg-inside", "sg-outside" or "custom" |
custom_layout | depends on code_layout | integer, custom layout ID, required when the code_layout is "custom" |
use_serial_number | optional | false or true (default), if true, serial numbers are added |
is_hybrid | optional | false or true (default), non-hybrid or hybrid printing method |
template_image | optional | false (default) or true, whether there's an image of the template |
is_fp_serialized | optional | false or true (default), whether codes are serialized |
is_static_print | optional | false (default) or true, whether the codes are static |
static_unique_codes_quantity | optional | integer, quantity of static unique codes |
printing_partner | required | integer, company ID of the Printing Partner |
reference | required | string, internal reference, must be unique for the company. |
remarks | optional | string, description of this workorder |
url_prefix | optional | string, set if a special URL is used (default: https://st4.ch/q/) |
partner_permissions | optional | A list of available partner permissions e.g. ["activate_codes"] |
IMPORTANT: Attribute values need to change based on workorder template. When a workorder template is chosen, if attributes are provided in workorder template, they are also required in the POST Request. The attributes cannot be passed with template
id.
Example JSON payload
{
"product": "P2",
"template": "1",
"quantity": "10",
"remarks": "remarks 1",
"activate_on_complete": true,
"extended_id_style": "legacy",
"substrate": 1,
"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": 3
}
Response (201): Created
{
"id": 24,
"company": {
"id": 2,
...
},
"printing_partner": {
"id": 3,
...
},
"equipment": {
"id": 1,
...
},
"state": "new",
"due_date": null,
"reference": null,
"creation_date": "2021-03-10T08:35:39.507156Z",
"code_layout": "sg-outside",
"use_serial_number": true,
"static_unique_codes_quantity": 0,
"quantity": 10,
"is_ready_to_print": false,
"date_codes_completed": null,
"is_archived": false,
"codegen_status": 1,
"codegen_file": null,
"data": {
"remarks": "remarks 1",
"static_unique_codes_quantity": 0,
"activate_on_complete": true
},
"product": {
"id": 2,
...
},
"brand": {
"id": 1,
...
},
"remarks": "remarks 1",
"printed_date": null,
"has_secure_workflow": false,
"static_impositions": 0,
"designer": null,
"external_id": "",
"is_fingerprint_trained": false,
"substrate": {
"id": 1,
"name": "Plain Paper",
"description": ""
},
"template": 1,
"template_image": null,
"is_hybrid": false,
"is_static_print": false,
"is_fp_serialized": false,
"url_prefix": "HTTPS://QR2.CH/Q/",
"extended_id_style": "legacy",
"partner_permissions": []
}
API Design - Printer Confirm
Before SSC codes are generated, a printing partner needs to confirm the printing equipment and substrate in order for the QA to be done.
PATCH /api/v2/workorders/4977/printer-confirm/
Example JSON payload
{
"substrate": "1",
"equipment": "2",
"external_id": "3"
}
Response (200): Ok
{
"id": 5094,
"company": {
"id": 339,
...
},
"printing_partner": {
"id": 346,
...
},
"equipment": {
"id": 214,
...
},
"state": "new",
"due_date": null,
"reference": "Tk-022",
"creation_date": "2021-03-10T08:46:55.234818Z",
"code_layout": "sg-inside",
"use_serial_number": true,
"static_unique_codes_quantity": 1,
"quantity": 100,
"is_ready_to_print": false,
"date_codes_completed": null,
"is_archived": false,
"codegen_status": 6,
"codegen_file": null,
"data": {
"remarks": "test",
"activate_on_complete": false,
"static_unique_codes_quantity": 1
},
"product": {
"id": 6134,
...
},
"brand": {
"id": 143,
...
},
"remarks": "test",
"printed_date": null,
"has_secure_workflow": false,
"static_impositions": 0,
"designer": null,
"external_id": "tk_001",
"is_fingerprint_trained": false,
"substrate": {
"id": 74,
...
},
"template": 105,
"template_image": null,
"is_hybrid": false,
"is_static_print": false,
"is_fp_serialized": false,
"url_prefix": "HTTPS://QR1.CH/Q/",
"extended_id_style": "legacy",
"partner_permissions": []
}
Important fields
- state: changes from "new" to "ready to print" or "completed"
- codegen_status: shows the code-generation status in a numerical way. Goes from "6" to "4" to indicate generation has completed.
- codegen_file: the link to the file containing the generated codes.
- activate_on_complete: determines the code-status after the workorder has been printed. Either codes stay inactive (activation_status: 0) or are activated (activation_status: 1)