Order Desk API: Deleting Shipments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Order Desk API: Delete Shipments | |
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced | |
//Setup | |
$store_id = 0; | |
$api_key = ""; | |
//Required: source_id or order_id | |
//Required: tracking_number or shipment_id | |
//Build a url and pass it to Order Desk with the DELETE request type | |
$url = "https://app.orderdesk.me/api/shipments?source_id=XXXXXXXX&tracking_number=YYYYYYYY"; | |
//Setup cURL Variables | |
$headers = array( | |
"ORDERDESK-STORE-ID: $store_id", | |
"ORDERDESK-API-KEY: $api_key", | |
'Content-Type: application/json', | |
); | |
//Setup cURL | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 10); | |
//Send To Order Desk and Parse Response | |
$response = trim(curl_exec($ch)); | |
$info = curl_getinfo($ch); | |
$json = json_decode($response, 1); | |
echo "<b>Response:</b><br>"; | |
echo "<pre>" . print_r($json, 1) . "</pre>"; | |
echo "<b>cURL Response:</b><br>"; | |
echo "<pre>" . print_r($info, 1) . "</pre>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment