Skip to main content

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:

  1. Brand Owner: Call the create SG workorder endpoint and retrieve the workorder id
  2. Printing Partner: confirm the workorder and generate the codes
  3. Brand Owner: Query the search workorder endpoint to verify the workorder has the state completed as well as the codegen_file download-link is available
  4. 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"
}
]
}

POST /api/v2/workorders/create-sg/

AttributeRequired?Description
productoptionalstring, Scantrust product SKU used for these codes.
templateoptionalinteger, retrieved from id in the above GET template request
quantityrequiredinteger, number of codes to be generated
remarksoptionalstring, description of this workorder
activate_on_completeoptionalfalse (default) or true, whether codes should be active immediately or not.
extended_id_styleoptional"compact-12" or "legacy", see Extended ID (default: legacy)
substrateoptionalinteger, substrate id (default: null)
code_layoutrequiredstring, code layout method, "sg-inside", "sg-outside" or "custom"
custom_layoutdepends on code_layoutinteger, custom layout ID, required when the code_layout is "custom"
use_serial_numberoptionalfalse or true (default), if true, serial numbers are added
is_hybridoptionalfalse or true (default), non-hybrid or hybrid printing method
template_imageoptionalfalse (default) or true, whether there's an image of the template
is_fp_serializedoptionalfalse or true (default), whether codes are serialized
is_static_printoptionalfalse (default) or true, whether the codes are static
static_unique_codes_quantityoptionalinteger, quantity of static unique codes
printing_partnerrequiredinteger, company ID of the Printing Partner
referencerequiredstring, internal reference, must be unique for the company.
remarksoptionalstring, description of this workorder
url_prefixoptionalstring, set if a special URL is used (default: https://st4.ch/q/)

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"
}

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"
}

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)