Skip to main content

Creating SID 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 SID workorder creation.

SID workorders are scantrust QR codes without the secure graphic. The brand owner can self-generate and download these workorders and they do not require a printing partner.

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.

Generating Serialized Identifiers (SID) workorders

Obtaining SID codes from the scantrust system requires 3 steps:

  1. Use the create SID workorder endpoint and retrieve a new workorder id
  2. Query the search workorder endpoint to verify the workorder has the state completed as well as the codegen_file download-link is available
  3. Call the download workorder file endpoint to download the codes and their images.
  4. Optionally: call the download workorder serial numbers endpoint to download a more simple csv format

Proceed to the (Downloading Workorders section)) for more information on the file content(s).

API Design: Create SID Workorder

SID codes are codes without the secure graphic. They can be generated relatively simply and dont need a complicated setup.

POST: /api/v2/workorders/create-sid/

Generate a workorder for a company

AttributeRequired?Description
activate_on_completerequiredfalse or true whether codes should be active immediately or not.
referencerequiredstring, internal reference, must be unique for the company.
remarksoptionalstring, description of this workorder
quantityrequiredinteger, number of codes to be generated
use_serial_numberrequiredfalse or true (default), if true, serial number are added
url_prefixoptionalstring, set if a special URL is used (default: https://st4.ch/q/)
productoptionalstring: Scantrust product SKU used for these codes.
extended_id_styleoptional"compact-12" or "legacy", see Extended ID (default: legacy)

The reference is important because it allows you to later look up the newly created workorder easily.

The full URL of a scantrust SID code is formed by using the url_prefix + extended_id. The length of the extended id is determined by the extended_id_style:

  • compact-12: 12 characters a-Z,0-9,-,_ (example: aB1_3dZ97-x2)
  • legacy: 32 characters A-Z,0-9 (example: AERFJHUI2GHAIPGEUHGEYUGF69G3EXF)

Example JSON payload

{
"activate_on_complete": false,
"reference": "REF-001",
"remarks": "Generated for Customer X",
"quantity": 100,
"use_serial_number": true,
"url_prefix": "https://my-url.com/",
"extended_id_style": "compact-12",
"product": "123456789"
}

Response (201): Created

When the workorder has been created, a JSON response will contain:

{
"id": 4879,
"company": {
"id": 339,
....
},
"printing_partner": null,
"equipment": null,
"state": "new",
"due_date": null,
"reference": "REF-001",
"creation_date": "2020-01-10T08:55:08.985433Z",
"code_layout": "none",
"use_serial_number": true,
"static_unique_codes_quantity": 1,
"quantity": 10,
"is_ready_to_print": false,
"date_codes_completed": null,
"is_archived": false,
"codegen_status": 6,
"codegen_file": null,
"data": {
"remarks": "Generated for Test Brand",
"activate_on_complete": false
},
"product": {
"id": ...,
...
},
"brand": {
"id": ...,
...
},
"remarks": "Generated for Test Brand",
"printed_date": null,
"has_secure_workflow": false,
"static_impositions": 0,
"designer": null,
"external_id": "",
"is_fingerprint_trained": false,
"substrate": null,
"template": null,
"template_image": null,
"is_hybrid": false,
"is_static_print": false,
"is_fp_serialized": false,
"url_prefix": "https://my-url.com/",
"extended_id_style": "compact-12"
}

Important fields

  • state: "new", "ready to print" or "completed"
  • codegen_status: shows the code-generation status in a numerical way. "4" indicates generation has completed succesfully
  • codegen_file: the link to the file containing the generated codes. Note that this link is directly created for SID workorders, but for the SSC-workorders the printing partner needs to confirm the workorder first before the generation starts.