CPL API
Useful links
  • Developer
  • Sandbox
Useful links
  • Developer
  • Sandbox
Přepni do češtiny
  1. Examples
  • Introduction
  • General
  • Creation of orders and shipments
  • Changelog
  • Authentication
    • Getting Bearer token
  • API Methods
  • Examples
    • Response - pick up labels (PDF A4)
    • Response - pickup label (ZPL)
    • Response - pick up label (JPG)
    • Shipment - shipment set items
    • International Shipment with or without COD – Parcels in a Set
    • Multiple shipments in one request
  • FAQ
  • Postman Collection
  1. Examples

Shipment - shipment set items

If you want to send multiple parcels in one shipment, you need to specify this in the field shipmentSet.numberOfShipments. Below is an example of a request with three parcels in a set.
Also note that the value isCompleteLabelRequested is set to true – this way, you will get a single shared URL for the complete set of labels.
POST shipment/batch request body for creating a shipment with multiple parcels in a set
{
  "returnChannel": {
    "type": "Email",
    "address": "jakub.test@ppl.cz"
  },
  "labelSettings": {
    "format": "Pdf",
    "dpi": 300,
    "completeLabelSettings": {
      "isCompleteLabelRequested": true
    }
  },
  "shipments": [
    {
      "referenceId": "123456",
      "productType": "BUSS",
      "note": "note for the label",
      "depot": "07",
      "shipmentSet": {
        "numberOfShipments": 3
      },
      "sender": {
        "name": "Mirek test",
        "street": "Testovaci 222",
        "city": "Prague",
        "zipCode": "11000",
        "country": "CZ",
        "phone": "123456789",
        "email": "kuba@seznam.cz"
      },
      "recipient": {
        "name": "Test recipient",
        "street": "HLinska 2",
        "city": "České Budějovice",
        "zipCode": "37001",
        "country": "CZ",
        "phone": "1236547895",
        "email": "xxx@email.cz"
      }
    }
  ]
}
After creating such a shipment, you will receive the following response when calling GET shipment/batch/{batchId}:
Response from GET shipment/batch/{batchId}
{
  "completeLabel": {
    "labelUrls": [
      "https://api-dev.dhl.com/ecs/ppl/myapi2/shipment/batch/cdf7496e-02a3-4d48-9500-7608c7dcc5c2/label?pageSize=Default&position=1&limit=200&offset=0"
    ]
  },
  "items": [
    {
      "referenceId": "123456",
      "shipmentNumber": "80050527927",
      "labelUrl": "https://api-dev.dhl.com/ecs/ppl/myapi2/data/95d48050-f9ad-451c-7a22-08dd6b49c76d",
      "importState": "Complete",
      "relatedItems": [
        {
          "shipmentNumber": "80050527928",
          "labelUrl": "https://api-dev.dhl.com/ecs/ppl/myapi2/data/cb3abe84-3785-48b8-6385-08dd6b49c76c",
          "importState": "Complete",
          "relationType": "ShipmentSet"
        },
        {
          "shipmentNumber": "80050527929",
          "labelUrl": "https://api-dev.dhl.com/ecs/ppl/myapi2/data/1897234a-567c-4974-7a21-08dd6b49c76d",
          "importState": "Complete",
          "relationType": "ShipmentSet"
        }
      ]
    }
  ]
}
At the top of the response, you will find the object completeLabel.
This object is included in the response only if you set "isCompleteLabelRequested": true in the request, and its URL contains all labels in the set.
{
  "completeLabel": {
    "labelUrls": [
      "https://api-dev.dhl.com/ecs/ppl/myapi2/shipment/batch/cdf7496e-02a3-4d48-9500-7608c7dcc5c2/label?pageSize=Default&position=1&limit=200&offset=0"
    ]
  }
}
image.png
Below completeLabel, you will find individual parcels, where the first one is always the primary shipment and the others are parcels in the set.
Each parcel contains its own labelUrl with the corresponding label.
Here is an example of the primary shipment:
"items": [
  {
    "referenceId": "123456",
    "shipmentNumber": "80050527927",
    "labelUrl": "https://api-dev.dhl.com/ecs/ppl/myapi2/data/95d48050-f9ad-451c-7a22-08dd6b49c76d",
    "importState": "Complete"
  }
]
image.png
Previous
Response - pick up label (JPG)
Next
International Shipment with or without COD – Parcels in a Set
Built with