This API can be used to generate and return a PDF label for an order generated in DI.
Environments / endpoints
HTTP method GET
TEST | https://staging-ws.di.no/ws/json/parcel/label/v-1/labels/{identifier}/{labelType} |
---|---|
PRODUCTION | https://ws.di.no/ws/json/parcel/label/v-1/labels/{identifier}/{labelType} |
What you need from DI
Example | |
---|---|
Username (see Authentication section) | wsfoobar |
Password (see Authentication section) | a-very-very-long-password |
The endpoint require authentication, as described here:Â LoginV2
Request header
key | value example | comment |
---|---|---|
Authorization | Bearer $SECRET_WS_TOKEN" | see Authentication |
Content-Type | application/json | |
Accept | application/pdf OR image/svg+xml | label in pdf format OR label in svg format |
Accept | application/json | warnings/ error messages in json format |
Request path parameters
key | value example | comment |
---|---|---|
identifier | (00)370724760010119754 | can be either a trackingReference or a shipmentId. If a shipmentId is specified the resulting pdf can return a pdf containing several pages (one for each item) |
labelType | unified-large | What kind of label that is wanted. The type determines both layout and size of the label. Currently the following types are supported *:
|
Example request
Comment: Notice that you have to specify two paramters in accept header, i.e. label format and error messages format (json)
curl --request GET --url https://staging-ws.di.no/ws/json/parcel/label/v-1/labels/00370724760010119754/unified-large \ --header "authorization: Bearer $SECRET_WS_TOKEN" \ --header 'content-type: application/json' \ --header 'accept: application/pdf,application/json' \
Error handling
If you make requests that the API doesn't support or an error in the API occurs, it will set a http status code that describes the error, and return a text string with an error message. Clients should gracefully handle that new error keys can be added at a later stage.
error key | status code |
---|---|
required.identifier | 400 |
unsupported.labelType | 400 |
no.access.api | 403 |
not.found | 404 |
service.point.not.set.for.order | 206 |
invalid.service.point.on.order | 206 |
cannot.find.routingcode.for.order | 206 |
no.access.shop.id | 403 |
unsupported.transportProduct | 501 |
internal.error | 500 |