Skip to main content

Download Work Orders

Overview

This step assumes the workorder has been created and codes have been generated for that workorder. For details on the generation process (see Generating Workorders section))

Downloading Code data from Work Orders requires the following steps:

  1. Download List of Work Orders
  2. Download Workorder File
  3. Extract the workorder zip file and process the codes

This page describes the API, however a prebuilt tool to generate QR images is also available here.

UAT token permissions

The UAT token needs to have access to the following permissions:

  • workorder_create
  • workorder_delete
  • workorder_cancel
  • workorder_download
  • workorder_edit
  • workorder_view
  • workorder_sid_download
  • workorder_archive

API Design: Download List of Work Orders

GET: /api/v2/workorders/

Gets the list of workorders for a company.

AttributeRequired?Description
is_archivedoptional0 or 1 Wether to show archived workorder .
limitoptionalinteger, default set to 20
offsetoptionalnumber in the range of total results.
searchoptionalstring to search in reference and remarks

Response (200): Status OK

When there are workorders to be listed, a response will be given.

{
"count": 1,
"next": "http://api.scantrust.com/api/v2/workorders/?is_archived=0&limit=20&offset=20",
"previous": null,
"results": [
{
"id": 1290,
"company": {
"id": 28,
"slug": "scantrust-employees",
"address": "EPFL",
"country": "CH",
"city": "Lausanne",
"company_type": "brand_owner",
"company_workflow_survey": {},
"has_secure_workflow": false,
"encryption_key": "",
"uuid": "6f6d65f9-026c-48f3-808f-53dadc779996",
"name": "Scantrust Team",
"website": "https://www.scantrust.com",
"creation_date": "2015-07-23T07:51:41.561552Z",
"serial_number_format": "",
"is_validated": true,
"workflow_survey": {}
},
"printing_partner": {
"id": 291,
"slug": "codex",
"address": "Szüret utca 5.",
"country": "HU",
"city": "Budakeszi",
"company_type": "printing_partner",
"company_workflow_survey": {},
"has_secure_workflow": false,
"encryption_key": "",
"uuid": "ae79a9dc-369e-4a38-a31b-2c1a6954462b",
"name": "Codex",
"website": "https://codex.hu",
"creation_date": "2018-06-15T11:56:03.771992Z",
"serial_number_format": "",
"is_validated": true,
"workflow_survey": {}
},
"equipment": {
"id": 264,
"name": "Xeikon 1",
"short_name": "Xeikon",
"in_calibration_mode": false,
"resolution_dpi": 1200,
"has_secure_workflow": false,
"location": "Szüret utca 5., 2092 Budakeszi",
"technology": 4,
"technology_other_name": "",
"creation_date": "2018-06-15T11:59:46.241767Z",
"is_archived": false,
"substrates": [
{
"id": 1225,
"status": 1,
"creation_date": "2018-06-15T12:03:14.094325Z",
"is_archived": false,
"name": "TC_60-PP white",
"description": "PP white ftc60rp37hd70",
"reference": "6415788236536",
"actions": {
"unarchive": null,
"archive": "http://api.scantrust.com/api/v2/equipment/264/substrates/1225/archive/"
}
},
{
"id": 1238,
"status": 1,
"creation_date": "2018-09-25T14:56:39.921323Z",
"is_archived": false,
"name": "Codex Secure Paper",
"description": "To be eventually updated later with exact name",
"reference": "",
"actions": {
"unarchive": null,
"archive": "http://api.scantrust.com/api/v2/equipment/264/substrates/1238/archive/"
}
},
{
"id": 1250,
"status": 1,
"creation_date": "2018-10-17T09:39:38.285432Z",
"is_archived": false,
"name": "TamperProof",
"description": "127 gsm, matte",
"reference": "",
"actions": {
"unarchive": null,
"archive": "http://api.scantrust.com/api/v2/equipment/264/substrates/1250/archive/"
}
}
]
},
"state": "completed",
"due_date": "2018-10-18",
"reference": "001.2",
"creation_date": "2018-10-18T09:40:04.626080Z",
"code_application": 2,
"use_serial_number": true,
"static_unique_codes_quantity": 1,
"requested_quantity": 10000,
"is_ready_to_print": true,
"date_codes_completed": "2018-10-23T16:12:14.436469Z",
"is_archived": false,
"codegen_status": 4,
"codegen_file": "/api/v2/workorders/1290/download-codes/",
"data": {
"static_unique_codes_quantity": 1,
"code_dimensions": "",
"downloaded": {
"timestamp": "2018-10-23T16:12:20.346218+00:00",
"actor": {
"id": 684,
"name": "Tamás Tilli"
}
},
"fingerprint_id": 146294,
"remarks": "",
"bundle_id": 1194,
"activate_on_complete": false
},
"product": {
"id": 822,
"uuid": "8c5d5549-ebdb-446c-99d0-4edb16ca10b3",
"sku": "001",
"image": null,
"name": "GoodChain labels #1",
"description": "",
"label": "GoodChain labels #1",
"brand": {
"id": 174,
"name": "GoodChain",
"image": "https://cc.scantrust.com/c/28/brand/blob-hidolh.png"
},
"company": {
"id": 28,
"uuid": "6f6d65f9-026c-48f3-808f-53dadc779996",
"name": "Scantrust Team"
},
"creation_date": "2018-10-08T09:32:12.830416Z",
"client_url": "https://thegoodchain.io/index.html#slush-logo",
"is_archived": false,
"campaign": {
"id": 46,
"name": "Presentation Codes",
"description": "This campaign has no STC. All products go to their own Product URL.",
"is_archived": false
},
"smartlabel": null
},
"brand": {
"id": 174,
"name": "GoodChain",
"description": "GoodChain",
"client_url": "http://www.goodchainfoundation.org",
"reference": "GoodChain",
"image": "https://cc.scantrust.com/c/28/brand/blob-hidolh.png",
"creation_date": "2018-07-04T08:13:02.844431Z",
"is_archived": false
},
"code_dimensions": "",
"remarks": "",
"production_quantity": 10500,
"printed_quantity": 10500,
"printed_date": "2018-11-01T10:52:35.991937Z",
"has_secure_workflow": false,
"static_impositions": 0,
"designer": null,
"external_id": "182422",
"is_fingerprint_trained": true,
"substrate": {
"id": 1250,
"name": "TamperProof",
"description": "127 gsm, matte"
}
}
]
}

API Design - Download Workorder File

The codes for each workorder are generated after the printing partner confirms the details. If the workorder is for fewer that 100,000 codes, all images are generated. If the workorder exceeds 100,000 codes, the workorder file only contains the CSV file with the list of codes as well as a sample image of a code. This file is then used with the Scantrust QR code generator to generate the images locally by the printer.

GET: /api/v2/workorders/{workorder_id}/download-codes/

Download the pre-generated ZIP file of the workorder:

AttributeRequired?Description
workorder_idrequiredthe ID of the workorder

Response (200): Status OK

Downloads the ZIP file of the workorder

Extract the workorder zip file and process the codes

Inside this zipfile you will find various files:

  • codes.csv
  • codes (folder)
  • secure_graphic.tiff
  • generate.txt
  • manifest.json
codes.csv

File containing all codes in comma-delimited format with a header:

extended_id,serial_number,sequence,batch,full_url
codes (folder)

Folder containing the images generated for this workorder. In case of Workorders with > 120,000 codes, this folder is omitted and the offline generator needs to be used to generate the images. This is done to offload the scantrust server and reduce the download time for printing partners.

secure_graphic.tiff

This file contains the secure graphic used for generating the SSC codes. Only gets generated for SSC Workorders (see Generating Workorders section))

This file can also be used by printing partners to generate hybrid codes whereby the secure graphic is printed in a different technology / run from the QR code.

generate.txt

Text file containing instructions to generate the codes offline. This is useful in case codes have to be augmented with a suffix, or if download restrictions make it hard to download large files.

manifest.json

File containing all the details to generate and print the codes. Details go beyond the scope of this API documentation:

{
"format": "v3",
"company": {
"id": 339,
"name": "Test Brand 0",
"type": "1"
},
"printing_partner": {
"id": 346,
"name": "Tobi Printer",
"type": "2"
},
"workorder": {
"id": 4865,
"reference": "SSC-02",
"external_id": "test with custom prefex",
"run_length": 100,
"url_prefix": "http://my.qrcode.com",
"due_date": null,
"creation_date": "2021-02-10T04:07:46.240337Z",
"use_serial_number": true,
"code_layout": "sg-inside",
"is_hybrid": false,
"is_fp_serialized": false,
"is_static_print": false
},
"codes": {
"count": 100,
"batch_size": 100,
"batch_count": 1
},
"code_type": {
"pu": 2,
"layout": 0,
"density": 40,
"buffer_size": 15,
"marker_size": 16,
"buffer_min_px": 13,
"carrier_cells": 33,
"resolution_dpi": 2540.0,
"carrier_cell_size": 31,
"placeholder_cells": 11,
"placeholder_offset": 0,
"secure_code_version": 9,
"fingerprint_serialization_mode": 0
},
"equipment": {
"name": "Test Printer One",
"short_name": "TK-01",
"location": "77 Jiangning Rd., 601",
"technology": "Other",
"resolution_dpi": 2540.0
},
"substrate": {
"name": "Legacy Substrate for PU 2, Density 40%",
"description": "Test substrate please ignore",
"is_calibrated": true,
"tolerance_min": 0.0,
"tolerance_max": 100.0
}
}