Update tracking status of a parcel

After a tracking identifier has been allocated to a parcel then events related to the progress of the delivery can be created using a delivery leg event. Such events will be included in the tracking history alongside tracking events received from other data source such as carrier tracking events, and will be returned in a unified single tracking history in the parcel journey.

Find out about the list of supported delivery leg events in Supported tracking events section of the documentation.

In this example, an AWAITING_DESPATCH delivery leg event will be created in order to inform the recipient that the parcel is ready to be picked up by the carrier. This event will apply to the parcel tracked using the tracking identifier TRACK-001 for which a delivery leg has already been created.

Steps:

Copy
Copied
{
  "trackingIdentifier": "TRACK-001",
  "eventCode": "AWAITING_DESPATCH",
  "eventDate": "2022-06-26T15:27:42.306Z",
  "eventTimeZone": "Europe/London"
}
  • Send the request to create the delivery leg event.
  • Expect a successful response with 204 No Content response code.

After the delivery leg event has been created, check that the status of delivery for the parcel has been updated by retrieving the parcel journey using the tracking identifier allocated to the parcel.

  • Open the resource GET Retrieve the parcel journeys for an order or a parcel .
  • In the tab Parameters , set the value of the query parameter trackingIdentifier to TRACK-001 .
  • Remove all other query parameters so that only the query parameter trackingIdentifier is retained.
  • Send the request to retrieve the parcel journey using the tracking identifier of the parcel.
  • Expect a successful response with a 200 OK response code and the following JSON body:
Copy
Copied
[
    {
        "delivery": {
            "type": "HOME",
            "direction": "OUTBOUND",
            "carrierServiceType": "TRACKED"
        },
        "parcel": {
            "deliveryLegs": [
                {
                    "carrierCode": "DPD_UK",
                    "carrierTrackingURL": "https://www.dpd.co.uk/service/tracking?parcel=TRACK-001",
                    "trackingIdentifier": "TRACK-001",
                    "carrierDisplayName": "DPD UK",
                    "finalDeliveryLeg": true
                }
            ],
            "items": []
        },
        "latestTrackingStatus": {
            "eventCode": "AWAITING_DESPATCH",
            "eventDate": "2022-06-26T15:27:42.306Z",
            "eventTimeZone": "Europe/London",
            "trackingIdentifier": "TRACK-001",
            "eventDescription": "Ready for despatch",
            "statusCode": "PROCESSING",
            "statusDescription": "Processing",
            "eventCategory": "HAPPY"
        },
        "trackingEvents": [
            {
                "eventCode": "AWAITING_DESPATCH",
                "eventDate": "2022-06-26T15:27:42.306Z",
                "eventTimeZone": "Europe/London",
                "trackingIdentifier": "TRACK-001",
                "eventDescription": "Ready for despatch",
                "statusCode": "PROCESSING",
                "statusDescription": "Processing",
                "eventCategory": "HAPPY"
            }
        ]
    }
]

The parcel journey now includes the events received for the parcel in the tracking history as well as the latest tracking status for this parcel.

The following fields have been added:

  • latestTrackingStatus : the latest tracking event informing about the progress of the delivery for the parcel.
  • trackingEvents : the list of tracking events received for this parcel sorted in chronological order.

The information contained in tracking events is composed of the information provided in the delivery leg event and enriched with information describing the event code and the classification of such event:

  • eventDescription : a human readable description that explains the event.
  • statusCode : a code that identifies the phase in the delivery journey for which the event occured.
  • statusDescription : a human readable description that explains the status code.
  • eventCategory : the category of event that the event code belongs to.