SQL Server / DHL Express APIs (MyDHL API) / Create a DHL Express pickup booking request
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OASetProperty @http, 'BasicAuth', 1
EXEC sp_OASetProperty @http, 'Login', '<Basic Auth Username>'
EXEC sp_OASetProperty @http, 'Password', '<Basic Auth Password>'
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "plannedPickupDateAndTime": "2019-08-04T14:00:31GMT+01:00",
-- "accounts": [
-- {
-- "typeCode": "shipper",
-- "number": "123456789"
-- }
-- ],
-- "customerDetails": {
-- "shipperDetails": {
-- "postalAddress": {
-- "postalCode": "14800",
-- "cityName": "Prague",
-- "countryCode": "CZ",
-- "addressLine1": "V Parku 2308/10",
-- "provinceCode": "CZ",
-- "addressLine2": "addres2",
-- "addressLine3": "addres3",
-- "countyName": "Central Bohemia"
-- },
-- "contactInformation": {
-- "phone": "+1123456789",
-- "companyName": "Company Name",
-- "fullName": "John Brew",
-- "email": "that@before.de",
-- "mobilePhone": "+60112345678"
-- }
-- },
-- "receiverDetails": {
-- "postalAddress": {
-- "postalCode": "14800",
-- "cityName": "Prague",
-- "countryCode": "CZ",
-- "addressLine1": "V Parku 2308/10",
-- "provinceCode": "CZ",
-- "addressLine2": "addres2",
-- "addressLine3": "addres3",
-- "countyName": "Central Bohemia"
-- },
-- "contactInformation": {
-- "phone": "+1123456789",
-- "companyName": "Company Name",
-- "fullName": "John Brew",
-- "email": "that@before.de",
-- "mobilePhone": "+60112345678"
-- }
-- },
-- "bookingRequestorDetails": {
-- "contactInformation": {
-- "phone": "+1123456789",
-- "companyName": "Company Name",
-- "fullName": "John Brew",
-- "email": "that@before.de",
-- "mobilePhone": "+60112345678"
-- },
-- "postalAddress": {
-- "postalCode": "14800",
-- "cityName": "Prague",
-- "countryCode": "CZ",
-- "addressLine1": "V Parku 2308/10",
-- "provinceCode": "CZ",
-- "addressLine2": "addres2",
-- "addressLine3": "addres3",
-- "countyName": "Central Bohemia"
-- }
-- },
-- "pickupDetails": {
-- "postalAddress": {
-- "postalCode": "14800",
-- "cityName": "Prague",
-- "countryCode": "CZ",
-- "addressLine1": "V Parku 2308/10",
-- "provinceCode": "CZ",
-- "addressLine2": "addres2",
-- "addressLine3": "addres3",
-- "countyName": "Central Bohemia"
-- },
-- "contactInformation": {
-- "phone": "+1123456789",
-- "companyName": "Company Name",
-- "fullName": "John Brew",
-- "email": "that@before.de",
-- "mobilePhone": "+60112345678"
-- }
-- }
-- },
-- "shipmentDetails": [
-- {
-- "productCode": "amet",
-- "isCustomsDeclarable": false,
-- "unitOfMeasurement": "metric",
-- "packages": [
-- {
-- "weight": 10.5,
-- "dimensions": {
-- "length": 25,
-- "width": 35,
-- "height": 15
-- },
-- "typeCode": "3BX"
-- }
-- ],
-- "localProductCode": "sed",
-- "accounts": [
-- {
-- "typeCode": "shipper",
-- "number": "123456789"
-- },
-- {
-- "typeCode": "shipper",
-- "number": "123456789"
-- }
-- ],
-- "valueAddedServices": [
-- {
-- "serviceCode": "II",
-- "localServiceCode": "II",
-- "value": 100,
-- "currency": "GBP",
-- "method": "cash"
-- },
-- {
-- "serviceCode": "II",
-- "localServiceCode": "II",
-- "value": 100,
-- "currency": "GBP",
-- "method": "cash"
-- }
-- ],
-- "declaredValue": 150,
-- "declaredValueCurrency": "CZK",
-- "shipmentTrackingNumber": "123456790"
-- }
-- ],
-- "closeTime": "18:00",
-- "location": "reception",
-- "locationType": "residence",
-- "specialInstructions": [
-- {
-- "value": "please ring door bell",
-- "typeCode": "TBD"
-- }
-- ],
-- "remark": "velit reprehenderit anim esse"
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'plannedPickupDateAndTime', '2019-08-04T14:00:31GMT+01:00'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'accounts[0].typeCode', 'shipper'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'accounts[0].number', '123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.postalCode', '14800'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.cityName', 'Prague'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.countryCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.addressLine1', 'V Parku 2308/10'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.provinceCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.addressLine2', 'addres2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.addressLine3', 'addres3'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.postalAddress.countyName', 'Central Bohemia'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.contactInformation.phone', '+1123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.contactInformation.companyName', 'Company Name'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.contactInformation.fullName', 'John Brew'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.contactInformation.email', 'that@before.de'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.shipperDetails.contactInformation.mobilePhone', '+60112345678'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.postalCode', '14800'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.cityName', 'Prague'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.countryCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.addressLine1', 'V Parku 2308/10'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.provinceCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.addressLine2', 'addres2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.addressLine3', 'addres3'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.postalAddress.countyName', 'Central Bohemia'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.contactInformation.phone', '+1123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.contactInformation.companyName', 'Company Name'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.contactInformation.fullName', 'John Brew'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.contactInformation.email', 'that@before.de'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.receiverDetails.contactInformation.mobilePhone', '+60112345678'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.contactInformation.phone', '+1123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.contactInformation.companyName', 'Company Name'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.contactInformation.fullName', 'John Brew'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.contactInformation.email', 'that@before.de'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.contactInformation.mobilePhone', '+60112345678'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.postalCode', '14800'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.cityName', 'Prague'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.countryCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.addressLine1', 'V Parku 2308/10'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.provinceCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.addressLine2', 'addres2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.addressLine3', 'addres3'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.bookingRequestorDetails.postalAddress.countyName', 'Central Bohemia'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.postalCode', '14800'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.cityName', 'Prague'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.countryCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.addressLine1', 'V Parku 2308/10'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.provinceCode', 'CZ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.addressLine2', 'addres2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.addressLine3', 'addres3'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.postalAddress.countyName', 'Central Bohemia'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.contactInformation.phone', '+1123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.contactInformation.companyName', 'Company Name'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.contactInformation.fullName', 'John Brew'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.contactInformation.email', 'that@before.de'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'customerDetails.pickupDetails.contactInformation.mobilePhone', '+60112345678'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].productCode', 'amet'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'shipmentDetails[0].isCustomsDeclarable', 0
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].unitOfMeasurement', 'metric'
EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'shipmentDetails[0].packages[0].weight', '10.5'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].packages[0].dimensions.length', 25
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].packages[0].dimensions.width', 35
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].packages[0].dimensions.height', 15
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].packages[0].typeCode', '3BX'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].localProductCode', 'sed'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].accounts[0].typeCode', 'shipper'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].accounts[0].number', '123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].accounts[1].typeCode', 'shipper'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].accounts[1].number', '123456789'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[0].serviceCode', 'II'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[0].localServiceCode', 'II'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].valueAddedServices[0].value', 100
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[0].currency', 'GBP'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[0].method', 'cash'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[1].serviceCode', 'II'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[1].localServiceCode', 'II'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].valueAddedServices[1].value', 100
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[1].currency', 'GBP'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].valueAddedServices[1].method', 'cash'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'shipmentDetails[0].declaredValue', 150
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].declaredValueCurrency', 'CZK'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'shipmentDetails[0].shipmentTrackingNumber', '123456790'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'closeTime', '18:00'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'location', 'reception'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'locationType', 'residence'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'specialInstructions[0].value', 'please ring door bell'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'specialInstructions[0].typeCode', 'TBD'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'remark', 'velit reprehenderit anim esse'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Webstore-Platform-Name', ''
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Shipping-System-Platform-Name', ''
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Message-Reference', 'd0e7832e-5c98-11ea-bc55-0242ac13'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Plugin-Version', ''
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Plugin-Name', ''
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Shipping-System-Platform-Version', ''
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Message-Reference-Date', 'Wed, 21 Oct 2015 07:28:00 GMT'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Webstore-Platform-Version', ''
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://api-mock.dhl.com/mydhlapi/pickups', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "dispatchConfirmationNumbers": [
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456",
-- "PRG201220123456"
-- ],
-- "readyByTime": "12:00",
-- "nextPickupDate": "2020-06-01",
-- "warnings": [
-- "Pickup created bu somthing went wrong",
-- "Pickup created bu somthing went wrong"
-- ]
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @strVal nvarchar(4000)
DECLARE @readyByTime nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @readyByTime OUT, 'readyByTime'
DECLARE @nextPickupDate nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @nextPickupDate OUT, 'nextPickupDate'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'dispatchConfirmationNumbers'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'dispatchConfirmationNumbers[i]'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'warnings'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'warnings[i]'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -X POST
-u '<Basic Auth Username>:<Basic Auth Password>'
-H "Message-Reference: d0e7832e-5c98-11ea-bc55-0242ac13"
-H "Message-Reference-Date: Wed, 21 Oct 2015 07:28:00 GMT"
-H "Plugin-Name: "
-H "Plugin-Version: "
-H "Shipping-System-Platform-Name: "
-H "Shipping-System-Platform-Version: "
-H "Webstore-Platform-Name: "
-H "Webstore-Platform-Version: "
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"plannedPickupDateAndTime": "2019-08-04T14:00:31GMT+01:00",
"accounts": [
{
"typeCode": "shipper",
"number": "123456789"
}
],
"customerDetails": {
"shipperDetails": {
"postalAddress": {
"postalCode": "14800",
"cityName": "Prague",
"countryCode": "CZ",
"addressLine1": "V Parku 2308/10",
"provinceCode": "CZ",
"addressLine2": "addres2",
"addressLine3": "addres3",
"countyName": "Central Bohemia"
},
"contactInformation": {
"phone": "+1123456789",
"companyName": "Company Name",
"fullName": "John Brew",
"email": "that@before.de",
"mobilePhone": "+60112345678"
}
},
"receiverDetails": {
"postalAddress": {
"postalCode": "14800",
"cityName": "Prague",
"countryCode": "CZ",
"addressLine1": "V Parku 2308/10",
"provinceCode": "CZ",
"addressLine2": "addres2",
"addressLine3": "addres3",
"countyName": "Central Bohemia"
},
"contactInformation": {
"phone": "+1123456789",
"companyName": "Company Name",
"fullName": "John Brew",
"email": "that@before.de",
"mobilePhone": "+60112345678"
}
},
"bookingRequestorDetails": {
"contactInformation": {
"phone": "+1123456789",
"companyName": "Company Name",
"fullName": "John Brew",
"email": "that@before.de",
"mobilePhone": "+60112345678"
},
"postalAddress": {
"postalCode": "14800",
"cityName": "Prague",
"countryCode": "CZ",
"addressLine1": "V Parku 2308/10",
"provinceCode": "CZ",
"addressLine2": "addres2",
"addressLine3": "addres3",
"countyName": "Central Bohemia"
}
},
"pickupDetails": {
"postalAddress": {
"postalCode": "14800",
"cityName": "Prague",
"countryCode": "CZ",
"addressLine1": "V Parku 2308/10",
"provinceCode": "CZ",
"addressLine2": "addres2",
"addressLine3": "addres3",
"countyName": "Central Bohemia"
},
"contactInformation": {
"phone": "+1123456789",
"companyName": "Company Name",
"fullName": "John Brew",
"email": "that@before.de",
"mobilePhone": "+60112345678"
}
}
},
"shipmentDetails": [
{
"productCode": "amet",
"isCustomsDeclarable": false,
"unitOfMeasurement": "metric",
"packages": [
{
"weight": 10.5,
"dimensions": {
"length": 25,
"width": 35,
"height": 15
},
"typeCode": "3BX"
}
],
"localProductCode": "sed",
"accounts": [
{
"typeCode": "shipper",
"number": "123456789"
},
{
"typeCode": "shipper",
"number": "123456789"
}
],
"valueAddedServices": [
{
"serviceCode": "II",
"localServiceCode": "II",
"value": 100,
"currency": "GBP",
"method": "cash"
},
{
"serviceCode": "II",
"localServiceCode": "II",
"value": 100,
"currency": "GBP",
"method": "cash"
}
],
"declaredValue": 150,
"declaredValueCurrency": "CZK",
"shipmentTrackingNumber": "123456790"
}
],
"closeTime": "18:00",
"location": "reception",
"locationType": "residence",
"specialInstructions": [
{
"value": "please ring door bell",
"typeCode": "TBD"
}
],
"remark": "velit reprehenderit anim esse"
}'
https://api-mock.dhl.com/mydhlapi/pickups
Postman Collection Item JSON
{
"name": "Create a DHL Express pickup booking request",
"request": {
"method": "POST",
"header": [
{
"description": "Please provide message reference\n",
"key": "Message-Reference",
"value": "d0e7832e-5c98-11ea-bc55-0242ac13"
},
{
"description": "Optional reference date in the HTTP-date format https://tools.ietf.org/html/rfc7231#section-7.1.1.2",
"key": "Message-Reference-Date",
"value": "Wed, 21 Oct 2015 07:28:00 GMT"
},
{
"description": "Please provide name of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Name",
"value": " "
},
{
"description": "Please provide version of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Version",
"value": " "
},
{
"description": "Please provide name of the shipping platform(applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the shipping platform (applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Version",
"value": " "
},
{
"description": "Please provide name of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Version",
"value": " "
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"plannedPickupDateAndTime\": \"2019-08-04T14:00:31GMT+01:00\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"customerDetails\": {\n \"shipperDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"receiverDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"bookingRequestorDetails\": {\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n },\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n }\n },\n \"pickupDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n }\n },\n \"shipmentDetails\": [\n {\n \"productCode\": \"amet\",\n \"isCustomsDeclarable\": false,\n \"unitOfMeasurement\": \"metric\",\n \"packages\": [\n {\n \"weight\": 10.5,\n \"dimensions\": {\n \"length\": 25,\n \"width\": 35,\n \"height\": 15\n },\n \"typeCode\": \"3BX\"\n }\n ],\n \"localProductCode\": \"sed\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n },\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"valueAddedServices\": [\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n },\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n }\n ],\n \"declaredValue\": 150,\n \"declaredValueCurrency\": \"CZK\",\n \"shipmentTrackingNumber\": \"123456790\"\n }\n ],\n \"closeTime\": \"18:00\",\n \"location\": \"reception\",\n \"locationType\": \"residence\",\n \"specialInstructions\": [\n {\n \"value\": \"please ring door bell\",\n \"typeCode\": \"TBD\"\n }\n ],\n \"remark\": \"velit reprehenderit anim esse\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/pickups",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups"
]
},
"description": "The Pickup service creates a DHL Express pickup booking request\n"
},
"response": [
{
"name": "Pickup created",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
},
{
"description": "Please provide message reference\n",
"key": "Message-Reference",
"value": "d0e7832e-5c98-11ea-bc55-0242ac13"
},
{
"description": "Optional reference date in the HTTP-date format https://tools.ietf.org/html/rfc7231#section-7.1.1.2",
"key": "Message-Reference-Date",
"value": "Wed, 21 Oct 2015 07:28:00 GMT"
},
{
"description": "Please provide name of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Name",
"value": " "
},
{
"description": "Please provide version of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Version",
"value": " "
},
{
"description": "Please provide name of the shipping platform(applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the shipping platform (applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Version",
"value": " "
},
{
"description": "Please provide name of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Version",
"value": " "
}
],
"body": {
"mode": "raw",
"raw": "{\n \"plannedPickupDateAndTime\": \"2019-08-04T14:00:31GMT+01:00\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"customerDetails\": {\n \"shipperDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"receiverDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"bookingRequestorDetails\": {\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n },\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n }\n },\n \"pickupDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n }\n },\n \"shipmentDetails\": [\n {\n \"productCode\": \"amet\",\n \"isCustomsDeclarable\": false,\n \"unitOfMeasurement\": \"metric\",\n \"packages\": [\n {\n \"weight\": 10.5,\n \"dimensions\": {\n \"length\": 25,\n \"width\": 35,\n \"height\": 15\n },\n \"typeCode\": \"3BX\"\n }\n ],\n \"localProductCode\": \"sed\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n },\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"valueAddedServices\": [\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n },\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n }\n ],\n \"declaredValue\": 150,\n \"declaredValueCurrency\": \"CZK\",\n \"shipmentTrackingNumber\": \"123456790\"\n }\n ],\n \"closeTime\": \"18:00\",\n \"location\": \"reception\",\n \"locationType\": \"residence\",\n \"specialInstructions\": [\n {\n \"value\": \"please ring door bell\",\n \"typeCode\": \"TBD\"\n }\n ],\n \"remark\": \"velit reprehenderit anim esse\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/pickups",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"dispatchConfirmationNumbers\": [\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\",\n \"PRG201220123456\"\n ],\n \"readyByTime\": \"12:00\",\n \"nextPickupDate\": \"2020-06-01\",\n \"warnings\": [\n \"Pickup created bu somthing went wrong\",\n \"Pickup created bu somthing went wrong\"\n ]\n}"
},
{
"name": "Wrong input parameters",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
},
{
"description": "Please provide message reference\n",
"key": "Message-Reference",
"value": "d0e7832e-5c98-11ea-bc55-0242ac13"
},
{
"description": "Optional reference date in the HTTP-date format https://tools.ietf.org/html/rfc7231#section-7.1.1.2",
"key": "Message-Reference-Date",
"value": "Wed, 21 Oct 2015 07:28:00 GMT"
},
{
"description": "Please provide name of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Name",
"value": " "
},
{
"description": "Please provide version of the plugin (applicable to 3PV only)\n",
"key": "Plugin-Version",
"value": " "
},
{
"description": "Please provide name of the shipping platform(applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the shipping platform (applicable to 3PV only)\n",
"key": "Shipping-System-Platform-Version",
"value": " "
},
{
"description": "Please provide name of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Name",
"value": " "
},
{
"description": "Please provide version of the webstore platform (applicable to 3PV only)\n",
"key": "Webstore-Platform-Version",
"value": " "
}
],
"body": {
"mode": "raw",
"raw": "{\n \"plannedPickupDateAndTime\": \"2019-08-04T14:00:31GMT+01:00\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"customerDetails\": {\n \"shipperDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"receiverDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n },\n \"bookingRequestorDetails\": {\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n },\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n }\n },\n \"pickupDetails\": {\n \"postalAddress\": {\n \"postalCode\": \"14800\",\n \"cityName\": \"Prague\",\n \"countryCode\": \"CZ\",\n \"addressLine1\": \"V Parku 2308/10\",\n \"provinceCode\": \"CZ\",\n \"addressLine2\": \"addres2\",\n \"addressLine3\": \"addres3\",\n \"countyName\": \"Central Bohemia\"\n },\n \"contactInformation\": {\n \"phone\": \"+1123456789\",\n \"companyName\": \"Company Name\",\n \"fullName\": \"John Brew\",\n \"email\": \"that@before.de\",\n \"mobilePhone\": \"+60112345678\"\n }\n }\n },\n \"shipmentDetails\": [\n {\n \"productCode\": \"amet\",\n \"isCustomsDeclarable\": false,\n \"unitOfMeasurement\": \"metric\",\n \"packages\": [\n {\n \"weight\": 10.5,\n \"dimensions\": {\n \"length\": 25,\n \"width\": 35,\n \"height\": 15\n },\n \"typeCode\": \"3BX\"\n }\n ],\n \"localProductCode\": \"sed\",\n \"accounts\": [\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n },\n {\n \"typeCode\": \"shipper\",\n \"number\": \"123456789\"\n }\n ],\n \"valueAddedServices\": [\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n },\n {\n \"serviceCode\": \"II\",\n \"localServiceCode\": \"II\",\n \"value\": 100,\n \"currency\": \"GBP\",\n \"method\": \"cash\"\n }\n ],\n \"declaredValue\": 150,\n \"declaredValueCurrency\": \"CZK\",\n \"shipmentTrackingNumber\": \"123456790\"\n }\n ],\n \"closeTime\": \"18:00\",\n \"location\": \"reception\",\n \"locationType\": \"residence\",\n \"specialInstructions\": [\n {\n \"value\": \"please ring door bell\",\n \"typeCode\": \"TBD\"\n }\n ],\n \"remark\": \"velit reprehenderit anim esse\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/pickups",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"instance\": \"/expressapi/pickups\",\n \"detail\": \"8003: Account not allowed for this service. Please contact your DHL Express representative.\",\n \"title\": \"Bad request\",\n \"message\": \"Bad request\",\n \"status\": \"400\"\n}"
}
]
}