Skip to content

Printing

Sondre Haugen edited this page Oct 18, 2023 · 15 revisions

Listing printers

Endpoint /printers
Formats XML, JSON
Authentication required? Yes
Sender ID required? No
Requires DirectPrint physically connected to thermal printer(s) No

Getting a list of all printers

cURL

curl -g -XGET -H'X-Cargonizer-Key: 12345' 'https://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://cargonizer.no/printers.json';
http.headers.add('X-Cargonizer-Key', '12345');
response = http.execute();

Printing labels

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.

Sending labels to a printer

cURL

curl -g -XPOST -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://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://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();

Getting labels as PDF

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://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://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();

Clone this wiki locally