Guides

2. Label creation requests

Once the carrier setup is completed you are ready to start generating labels.


An example of a user creating a [Shipment](#shipment) and getting a [Shipment Label](#shipment-label) back

The request flow when creating a shipping label

The label generation process in the Carrier Integration Service is a synchronous operation. Xentral will make a request to your service, and expects a response back that contains a label and some other data.

Request:

curl --request POST \
     --url https://xentral.example-carrier-service.com/xentral/shipments \
     --header 'Accept-Language: de-DE' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '
{
 "carrier": {
    "product": {
      "id": "[your carrier product id]"
    },
    "id": "[your carrier id]"
  },
	"recipient": {
    "name": "John Doe",
    "address": "Fugerstr. 12",
    "city": "Augsburg",
    "zip": "86150",
    "country": "DE"
  },
  "sender": {
    "name": "Jane Doe",
    "address": "Fuggerstr. 11",
    "city": "Augsburg",
    "zip": "86150",
    "country": "DE"
  },
	"parcels": [
  	{
			"id": "675ea55c-ab95-425a-977f-c70da64aa3e2",
      "weight": {
      	"unit": "kg",
				"value": 1
      },
      "dimensions": {
        "length": {
        	"unit": "cm",
					"value": 10
        },
        "width": {
        	"unit": "cm",
					"value": 10
        },
        "height": {
        	"unit": "cm",
					"value": 10
        }
      }
    }
  ],
  "insurance": {
    "isInsured": false
  },
  "label": {
    "type": "pdf",
    "orientation": "portrait"
  },
	"deliveryNote": {
    "id": "1"
  },
  "shipment": {
    "id": "1"
  },
  "salesOrder": {
    "id": "1"
  }
}
'

And expects the following response:

{
  "shippingLabels": [
    {
      "parcelId": "675ea55c-ab95-425a-977f-c70da64aa3e2",
      "trackingId": "123456789",
      "trackingUrl": "https://tracking.post.ch/track/123456789",
      "label": {
        "type": "pdf",
        "data": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADOSURBVHgB1ZZpDoUwCITxnaT3v1SP0mdN49YNEDJKbPxhmfnSBVwS0frg4kfguAKEQBTjuibJZ2Tt7HGO/XMIxzvGZB5Z8+xRfA+A+wRLiJZ2BdCb6GGeowkwSrA0HwLMEi3MpwAcgSfmLACukDaHBSARlM5lA3CFpaslApgZaLZKDNAz0h5WFUALQntT1AB3CG2tKLnwdvyxLYAeQug1hBYiaCmGNiNoO35iztV45y+ZpfkMogLwMB9BVABe5j2ICsDTvAVRxrJRAAPejv8TASt8b/v+egAAAABJRU5ErkJggg=="
      }
    }
  ],
  "id": "675ea55c-ab95-425a-977f-c70da64aa3e2",
  "carrier": {
    "name": "Post Swiss"
  }
}

Creating a label in the UI

To trigger the label creation request can be triggered from three different places:

  • The Delivery Note
  • The Dispatch Center
  • Through automatic label generation

Example: create label in Delivery Note