The purpose of this API is to get details for a shipment.
⚠️ Fields marked with (WIP) are not available in production yet.
Content
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Setup
Example | Description | |
---|---|---|
Username (see Authentication section) | wsfoobar | A valid username. |
Password (see Authentication section) | a-very-very-long-password | A password matching given username. |
The user is a web service user
The user has access to the web service for parcel details
The user has access to the shop where the parcel is registered
We reserve the right to limit users who misuse this service.
Environments / endpoints
TEST
| https://staging-ws.di.no/ws/json/parcel/booking/v-1/details/${identifier} | ||||||
PRODUCTION
| https://ws.di.no/ws/json/parcel/booking/v-1/details/${identifier} |
The identifier can be either a shipment number, tracking reference or return code. (WIP)
Authentication
This endpoint requires the user to be authenticated. Refer to the documentation here for more information on how to obtain a valid token to use in your request.
...
Info |
---|
|
Request header
Key | Value |
---|---|
Authorization | Bearer "SECRET_WS_TOKEN" See authentication on how to obtain a token |
Content-Type | application/json |
Request body
None
Response
Name | Type | Example | Mandatory | Description |
---|---|---|---|---|
shipmentId | String | 70724760322123456 | yes | The id-number of the shipment |
ediStatus | String | EXPORT_OK | yes | The current EDI-status of the shipment |
shopid |
Integer | 1 | yes | The id of the shop for the shipment | |
shopName |
String | TestShop | yes | The name of the shop for the shipment |
desiredDeliveryDate (WIP) | Date | 2023-10-05 | no | If available, the desired delivery date for the shipment |
pickupDetails | Object | no | This object will be populated if the shipment is a pickup shipment | |
pickupDetails-returnCode |
String | R-12345 | no | The return code of the shipment | |
pickupDetails-placement |
String | mailbox, door, common-box, newspaper | no | Where the consumer should place the shipment | |
pickupDetails-pickupDate |
Date | 2023-08-31 | no | The date the shipment will be picked up by the distribution. If null, no date has been set. The customer should place the shipment at the assigned spot the day before. | |
pickupDetails-possiblePickupDates |
List<Date> | [2023-08-31, 2023-09-01, … ] | no | A list of future possible pickup dates | |
items | Array | yes | List of one or more items in the shipment | |
items-trackingReference | String | 370724760322123456 | yes | Tracking number for the given item |
items-labellessCode | String | TESTCODE | no | Submission code received from PostNord in case this is a myPackGo item |
Response details for ediStatus
ediStatus | Comment |
---|---|
ATTEMPTING_EXPORT | We are attempting to forward the bookingdata/edi to the carrier/company responsible to perform the delivery. For the majority this will take seconds, but can take up to 2 hours (depending on carrier, availability and so on) Action: None, everything is normal with this status. |
EXPORT_OK | The bookingdata/edi is registered with the carrier/company responsible to perform the delivery, and the registration was successful. Action: None, everything is normal with this status. |
EXPORT_FAILED_WILL_RETRY | We have attempted to forward the bookingdata/edi to the carrier/company responsible to perform the delivery, but the carrier was not able to receive it at the time. The bookingdata/edi will receive this status when the service the carrier have is unavailable. Most likely the unavailability is short, and the bookingdata/edi will be registered shortly. Action: No action needed yet. The system will automatically retry registration of the bookingdata/edi. This can take up to 5 hours. |
EXPORT_FAILED_PERMANENTLY | We have attempted to forward the bookingdata/edi to the carrier/company responsible to perform the delivery, but the carrier was not able to receive it. The bookingdata/edi will receive this status when the service the carrier have is unavailable over a long periode of time or the request in invalid (missing mandatory data, invalid values and so on) Action: With no action this bookingdata/edi will not be registered with the carrier. Based on the type of booking we suggest the following actions
|
CANCELLED | The shipment has been cancelled and will not be picked up |
PASSIVE_RETURN | The shipment has been registered, but not yet activated. Use the Parcel Activate Order API to set a date for the pickup. |
Examples
Expand | ||
---|---|---|
| ||
|
...
In addition to HTTP status there may be more details in the errorKey field. Error Keys can be added at a later stage, clients should handle this as well as an empty value for errorKey
.
HTTP Status code | Text | Description |
---|---|---|
400 | Client or Validation Error | The request body/query string is not in the correct format. |
401 | Authentication Failure | Indicates that the Authorization header is either missing or incorrect. You can learn more about the Authorization header here. |
403 | Access denied | This indicates that the agent whose credentials were used in making this request was not authorized to perform this API call. It could be that you do not have access to the shop or transportsolution you provided in your request. If you believe this is a mistake, please reach out to your contact so it can be rectified. |
405 | Method not allowed | This API request used the wrong HTTP verb/method. For example a PUT request will result in this error. |
4xx | Client error | Generally receiving an error code that starts with 4 indicates that the client needs to change something. |
500 | Unexpected Server Error | Oops! This indicates an error on our side, and there is nothing more you can do. Please [email|mailto:support@di.no] us a description of your problem and we will see what we can do. |
Error response
In addition to the HTTP status code, most errors will also return a response body that contains more information to help you debug the error. A sample error response is shown below. The format of the error response body is explained after the example.
...
Code Block |
---|
{ "statusCode": 401, "errorKey": "authentication.missing", "errorMap": {} } |
Field | Description |
---|---|
statusCode | The HTTP code associated with this error. |
errorKey | A machine parseable error code. |
errorMap | Additional details pertaining to the error. |