Repository navigation
Printing
| Endpoint | /printers |
| Formats | XML, JSON |
| Authentication required? | Yes |
| Sender ID required? | No |
| Requires DirectPrint physically connected to thermal printer(s) | No |
cURL
curl -g -XGET -H'X-Cargonizer-Key: 12345' 'https://api.cargonizer.no/printers.json'HTTP
GET /printers.json HTTP/1.1
Host: cargonizer.no
X-Cargonizer-Key: 12345
Pseudocode
http = new HTTPRequest();
http.method = 'GET';
http.url = 'https://api.cargonizer.no/printers.json';
http.headers.add('X-Cargonizer-Key', '12345');
response = http.execute();
| Endpoint | /printers |
| Formats | XML, JSON |
| Authentication required? | Yes |
| Sender ID required? | Yes |
| Requires DirectPrint physically connected to thermal printer(s) | Yes |
Labels can be sent directly to a registered printer, or they can be downloaded as a PDF file. Both of these endpoints take a list of consignment- and item IDs, such that you may provide an entire consignment (one or more labels for one or more items) or a single consignment item (one label) to print.
Note: If you plan to print in bulk, you must make one single call and enter the shipments as an array. Then you will have a guarantee for a single print job where the labels come out in the same order. Do not print one label at a time as you may get the order wrong and labels (print jobs) may disappear.
cURL
curl -g -XPOST -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://api.cargonizer.no/consignments/label_direct?printer_id=123&consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4'HTTP
POST /consignments/label_direct?printer_id=123&consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4 HTTP/1.1
Host: cargonizer.no
X-Cargonizer-Key: 12345 X-Cargonizer-Sender: 678
Pseudocode
http = new HTTPRequest();
http.method = 'POST';
http.url = 'https://api.cargonizer.no/consignments/label_direct?printer_id=123&consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4';
http.queryStringParameters.set('printer_id', '123');
http.queryStringParameters.set('consignment_ids[]', '1');
http.queryStringParameters.set('consignment_ids[]', '2');
http.queryStringParameters.set('piece_ids[]', '3');
http.queryStringParameters.set('piece_ids[]', '4');
http.headers.add('X-Cargonizer-Key', '12345');http.headers.add('X-Cargonizer-Sender: 678');response = http.execute();
| Endpoint | /printers |
| Formats | XML, JSON |
| Authentication required? | Yes |
| Sender ID required? | Yes |
cURL
curl -g -XGET -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://api.cargonizer.no/consignments/label_pdf?consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4'HTTP
GET /consignments/label_pdf?consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4 HTTP/1.1
Host: cargonizer.no
X-Cargonizer-Key: 12345
X-Cargonizer-Sender: 678
Pseudocode
http = new HTTPRequest();
http.method = 'GET';
http.url = 'https://api.cargonizer.no/consignments/label_pdf?consignment_ids[]=1&consignment_ids[]=2&piece_ids[]=3&piece_ids[]=4';
http.queryStringParameters.set('consignment_ids[]', '1');
http.queryStringParameters.set('consignment_ids[]', '2');
http.queryStringParameters.set('piece_ids[]', '3');
http.queryStringParameters.set('piece_ids[]', '4');
http.headers.add('X-Cargonizer-Key', '12345');
http.headers.add('X-Cargonizer-Sender', '678');
response = http.execute();
| Endpoint | /printers |
| Formats | XML, JSON |
| Authentication required? | Yes |
| Sender ID required? | Yes |
cURL
curl -g -XGET -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://api.cargonizer.no/consignments/waybill_pdf?consignment_ids[]=1&consignment_ids[]=2'HTTP
GET /consignments/waybill_pdf?consignment_ids[]=1&consignment_ids[]=2 HTTP/1.1
Host: cargonizer.no
X-Cargonizer-Key: 12345
X-Cargonizer-Sender: 678
Pseudocode
http = new HTTPRequest();
http.method = 'GET';
http.url = 'https://api.cargonizer.no/consignments/waybill_pdf?consignment_ids[]=1&consignment_ids[]=2';
http.queryStringParameters.set('consignment_ids[]', '1');
http.queryStringParameters.set('consignment_ids[]', '2');
http.headers.add('X-Cargonizer-Key', '12345');
http.headers.add('X-Cargonizer-Sender', '678');
response = http.execute();
cURL
curl -g -XGET -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://api.cargonizer.no/consignments/goods_declaration_pdf?consignment_ids[]=1&consignment_ids[]=2'HTTP
GET /consignments/goods_declaration_pdf?consignment_ids[]=1&consignment_ids[]=2 HTTP/1.1
Host: cargonizer.no
X-Cargonizer-Key: 12345
X-Cargonizer-Sender: 678
Pseudocode
http = new HTTPRequest();
http.method = 'GET';
http.url = 'https://api.cargonizer.no/consignments/goods_declaration_pdf?consignment_ids[]=1&consignment_ids[]=2';
http.queryStringParameters.set('consignment_ids[]', '1');
http.queryStringParameters.set('consignment_ids[]', '2');
http.headers.add('X-Cargonizer-Key', '12345');
http.headers.add('X-Cargonizer-Sender', '678');
response = http.execute();
| Endpoint | /printers |
| Formats | JSON |
| Authentication required? | Yes |
| Sender ID required? | No |
| Requires DirectPrint physically connected to thermal printer(s) | Yes |
PrintsController enables sending pre-generated PDF/ZPL/EPL content to a printer.
POST /prints
Parameters
Required/allowed parameters:
{
print: {
printer: {
id: Integer
},
data: {
type: String['application/pdf' | 'application/x.zpl' | 'application/x.epl']
encoding: ?String['base64']
content: String
}
}
}
encoding is not required, but may be "base64" to indicate content is Base64 encoded.
JSON
Parameters can be provided through JSON:
{
"print": {
"printer": {"id": 12345},
"data": {
"type": "application/pdf",
"encoding": "base64",
"content": "..."
}
}
}encoding is necessarily "base64" with binary data, which can't be represented direcly in JSON.
curl
-XPOST \
-H'Content-Type: application/json' \
-H'Accept: application/json' \
--data-binary '{"print": {"printer": {...}, "data": {...}}}'
'https://api.cargonizer.no/prints'Content as HTTP body
Content to be printed can be provided directly in HTTP body by setting the Content-Type header appropriately. The value of the header is the type of content to be printed with an optional header param specifying Base64 encoding.
curl -XPOST \
--data-binary '^XA^FO50,60^A0,200^FDHello^FS^FO50,300^A0,200^FDWorld^FS^XZ' \
-H'Content-Type: application/x.zpl' \
-H'Accept: application/json' \
'https://api.cargonizer.no/prints?print[printer][id]=12345'curl \
-XPOST \
--data-binary 'XlhBXkZPNTAsNjBeQTAsMjAwXkZESGVsbG9eRlNeRk81MCwzMDBeQTAsMjAwXkZEV29ybGReRlNeWFoK' \
-H'Content-Type: application/x.zpl;encoding=base64' \
-H'Accept: application/json' \
'https://api.cargonizer.no/prints?print[printer][id]=12345'