This article explains how to create a thermal label for a parcel.
Step 1: Prepare and send a request
API Endpoint
To create a label, send an HTTP GET request to https://api.novapost.com/v.1.0/shipments/print.
Headers
There are two HTTP headers that need to be specified in the request:
- 1Accept: Specifies the response format. Use the PDF format as follows: application/pdf
- 2Authorization: This header should include your JWT token.
Request Body
In the body of the HTTP request, provide all the information about the thermal label you want to create, such as shipment numbers, label type, and size. Let's create a label with the following criteria:
- 1numbers: Shipment numbers.
- 2type: Can have values like marking, international, invoice.
- 3printSizeType: Can have values like size_100_100, size_A4.
- 4copies: Number of copies.
- Example request:
curl -X GET "https://api.novapost.pl/v1.0/shipments/print?numbers[]=SHPL1234567890&type=international&printSizeType=size_A4" \
-H "Accept: application/pdf" \
-H "Authorization: Bearer your_fresh_genereted_token_Nzk2NjY1NzZ9.kABs72NjY1NzZ9.kABs7W8h"
These URLs function like any other URLs, meaning you can paste them into a browser to download the file. You can also download the label using curl.
Step 2: Downloading the label
If your request is successful, you will receive a PDF file in response.
Step 3: Printing the label on a thermal printer
Once the label file is downloaded, you can print it on a thermal printer.