DataFlex / DHL Express APIs (MyDHL API) / Cancel a DHL Express pickup booking request
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "<Basic Auth Username>"
Set ComPassword Of hoHttp To "<Basic Auth Password>"
Send ComSetRequestHeader To hoHttp "Webstore-Platform-Name" ""
Send ComSetRequestHeader To hoHttp "Shipping-System-Platform-Name" ""
Send ComSetRequestHeader To hoHttp "Message-Reference" "d0e7832e-5c98-11ea-bc55-0242ac13"
Send ComSetRequestHeader To hoHttp "Plugin-Version" ""
Send ComSetRequestHeader To hoHttp "Plugin-Name" ""
Send ComSetRequestHeader To hoHttp "Shipping-System-Platform-Version" ""
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Send ComSetRequestHeader To hoHttp "Message-Reference-Date" "Wed, 21 Oct 2015 07:28:00 GMT"
Send ComSetRequestHeader To hoHttp "Webstore-Platform-Version" ""
Get ComQuickRequest Of hoHttp "DELETE" "leave" To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln iTemp1
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
Send Destroy of hoResp
End_Procedure
Curl Command
curl -X DELETE
-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 "Accept: application/json"
https://api-mock.dhl.com/mydhlapi/pickups/:dispatchConfirmationNumber?requestorName=Fred Brent&reason=Unplanned leave
Postman Collection Item JSON
{
"name": "Cancel a DHL Express pickup booking request",
"request": {
"method": "DELETE",
"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": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/pickups/:dispatchConfirmationNumber?requestorName=Fred Brent&reason=Unplanned leave",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups",
":dispatchConfirmationNumber"
],
"query": [
{
"key": "requestorName",
"value": "Fred Brent",
"description": "(Required) Name of the person requesting to cancel the scheduled pickup\n"
},
{
"key": "reason",
"value": "Unplanned leave",
"description": "(Required) Provide why scheduled pickup is being cancelled\n"
}
],
"variable": [
{
"key": "dispatchConfirmationNumber",
"value": "PRG999126012345",
"description": "(Required) Shipment pickup confirmation number for example `PRG999126012345`"
}
]
},
"description": "The Cancel Pickup service can be used to cancel a DHL Express pickup booking request\n"
},
"response": [
{
"name": "Pickup cancelled",
"originalRequest": {
"method": "DELETE",
"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": " "
}
],
"url": {
"raw": "{{baseUrl}}/pickups/:dispatchConfirmationNumber?requestorName=Fred Brent&reason=Unplanned leave",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups",
":dispatchConfirmationNumber"
],
"query": [
{
"key": "requestorName",
"value": "Fred Brent"
},
{
"key": "reason",
"value": "Unplanned leave"
}
],
"variable": [
{
"key": "dispatchConfirmationNumber",
"value": "PRG999126012345",
"description": "(Required) Shipment pickup confirmation number for example `PRG999126012345`"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Pickup already cancelled or completed / Wrong input parameters",
"originalRequest": {
"method": "DELETE",
"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": " "
}
],
"url": {
"raw": "{{baseUrl}}/pickups/:dispatchConfirmationNumber?requestorName=Fred Brent&reason=Unplanned leave",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups",
":dispatchConfirmationNumber"
],
"query": [
{
"key": "requestorName",
"value": "Fred Brent"
},
{
"key": "reason",
"value": "Unplanned leave"
}
],
"variable": [
{
"key": "dispatchConfirmationNumber",
"value": "PRG999126012345",
"description": "(Required) Shipment pickup confirmation number for example `PRG999126012345`"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"instance\": \"/expressapi/pickups/PRG211126000382\",\n \"detail\": \"Missing mandatory parameters: requestorName\",\n \"title\": \"Missing parameters\",\n \"message\": \"Bad request\",\n \"status\": \"400\"\n}"
},
{
"name": "Pickup not found",
"originalRequest": {
"method": "DELETE",
"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": " "
}
],
"url": {
"raw": "{{baseUrl}}/pickups/:dispatchConfirmationNumber?requestorName=Fred Brent&reason=Unplanned leave",
"host": [
"{{baseUrl}}"
],
"path": [
"pickups",
":dispatchConfirmationNumber"
],
"query": [
{
"key": "requestorName",
"value": "Fred Brent"
},
{
"key": "reason",
"value": "Unplanned leave"
}
],
"variable": [
{
"key": "dispatchConfirmationNumber",
"value": "PRG999126012345",
"description": "(Required) Shipment pickup confirmation number for example `PRG999126012345`"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"instance\": \"/expressapi/pickups/PRG211126000382?requestorName=Adam%20Spencer&reason=closed\",\n \"detail\": \"Cancellation of booking was not successful. Requested Pickup was not found\",\n \"title\": \"Pickup not found\",\n \"status\": \"404\"\n}"
}
]
}