CreateShipment

Creates a DPD Shipping Label

For accessing the DPD-Shipping Gebra Suite interface the DPD services need the following setup values (configuration -> settings).

  • DPDUserCredentialsCloudUserID

  • DPDUserCredentialsToken

  • DPDPartnerCredentialsName

  • DPDPartnerCredentialsToken

If no settings are available, a sample label will be generated.

Incomming Information

To create labels three groups of information are available:

  • 1. OrderSettings with the following fields (If the group is not present default values will be assumed)

    • language: Values „de_DE“ or „en_EN“ are allowed. If nothing is set „de_DE“ will be assumed.

    • ShipDate: if not available will be set to „today“

    • LabelSize: „PDF_A4“ or „PDF_A6“. If nothing is set „PDF_A4“ will be assumed.

    • LabelStartPosition: “UpperLeft“, „UpperRight“, „LowerLeft“, „LowerRigh“

  • 2. ShipAddress:

    • Company

    • Gender

    • Salutation

    • FirstName

    • LastName

    • Name

    • Street

    • HouseNo

    • ZipCode

    • City

    • Country

    • State

    • Phone

    • Mail

  • 3. ParcelData:

    • YourInternalID: should be set to your own reference (e.g. order no). if no value is provided a timestamp will be set.

    • Content

    • Weight: in kg

    • Reference1

    • Reference2

    • ShipService: set to a valid DPD-Service. If nothing is set “Classic” will be assumed.

Detailed informationen for field usage can be found at https://esolutions.dpd.com/dokumente/DPD_Cloud_Service_Webservice_Dokumentation_DE.pdf

Returning Information

  • In case of success (status 200) the following fields are returned

    • ParcelNo: The DPD generated ID. This will be used for further references to this shipment.

    • YourInternalID: The same ID that was provided for the request

    • TimeStamp: an informational time stamp when the request was processed

    • LabelData: this is a blob response. It contains the actual label in PDF format and can directly be used for further processing. E.g. “app.printBlob(LabelPDF);”

  • In case of error (status 400) the following fields are returned:

    • TimeStamp: an informational time stamp when the request was processed

    • ErrorDataList: an array with detailed information what went wrong. Every error will show the following fields

      • ErrorID: an internal error no

      • ErrorCode: an internal error code

      • ErrorMsgShort: Error information short version

      • ErrorMsgLong: Error information long version

Example Usages

/*----------------------------------------------------------------------------------------------
/This example is minimalistic and will create a sample label. 
/You need to check which fields are relevant for your process and assign the values accordingly.
/----------------------------------------------------------------------------------------------*/

var result = await app.businessFunction({
  functionName: "DPDShipping",
  methodName: "CreateShipment",
  ShipAddress: {
    Company: "Mustermann AG",
    Name: "Max Mustermann",
    Street: "Wailandtstr.",
    HouseNo: "1",
    ZipCode: "63741",
    City: "Aschaffenburg",
    Country: "DEU",
  },
  ParcelData: {
    Reference1: "Customer email",
    Content: "Order number",
    Weight: "13.5",
  },
});
console.log("Parcel Number: " + result.ParcelNo);
app.printBlob(result.LabelData);

/*----------------------------------------------------------------------------------------------
/This example uses all fields
/You need to check which fields are relevant for your process and assign the values accordingly.
/----------------------------------------------------------------------------------------------*/
var result = await app.businessFunction({
  functionName: "DPDShipping",
  methodName: "CreateShipment",
  OrderSettings: {
    language: "de_DE",
    LabelSize: "PDF_A4",
    LabelStartPosition: "UpperLeft",
    ShipDate: app.getFieldValue("SomeFieldValue"),
  },
  ShipAddress: {
    Company: app.getFieldValue("SomeFieldValue"),
    Gender: app.getFieldValue("SomeFieldValue"),
    Salutation: app.getFieldValue("SomeFieldValue"),
    FirstName: app.getFieldValue("SomeFieldValue"),
    LastName: app.getFieldValue("SomeFieldValue"),
    Name: app.getFieldValue("SomeFieldValue"),
    Street: app.getFieldValue("SomeFieldValue"),
    HouseNo: app.getFieldValue("SomeFieldValue"),
    ZipCode: app.getFieldValue("SomeFieldValue"),
    City: app.getFieldValue("SomeFieldValue"),
    Country: app.getFieldValue("SomeFieldValue"),
    State: "",
    Phone: app.getFieldValue("SomeFieldValue"),
    Mail: app.getFieldValue("SomeFieldValue"),
  },
  ParcelData: {
    Reference1: app.getFieldValue("SomeFieldValue"),
    Reference2: app.getFieldValue("SomeFieldValue"),
    Content: app.getFieldValue("SomeFieldValue"),
    Weight: app.getFieldValue("SomeFieldValue"),
    YourInternalID: app.getFieldValue("SomeFieldValue"),
    ShipService: app.getFieldValue("SomeFieldValue"),
  },
});
console.log("Parcel Number: " + result.ParcelNo);
app.printBlob(result.LabelData);

Last updated