Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

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 Parcel Label API#Authentication
Content-Typeapplication/json

Accept

application/pdf
OR
image/svg+xml
OR
application/zpl
label in pdf format
OR
label in svg format 
OR
label in zpl format
Acceptapplication/jsonwarnings/ 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)

labelTypeunified-large

What kind of label that is wanted. The type determines both layout and size of the label. Currently the following types are supported *:

  • "unified-large" - this label measures 102 mm x 192mm, and the layout is also known as the "Felles transportetikett"



* in the future could also make support for example "unified-A6" which is similar to "unified-large", but not so tall


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, with application/pdf response format
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 keystatus code
required.identifier400

unsupported.labelType

400
no.access.api403

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.error500
  • No labels