Skip to content

Instantly share code, notes, and snippets.

Created January 11, 2015 22:34
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sparkweb/5134278612b161b1cce3 to your computer and use it in GitHub Desktop.
Order Desk API: Deleting Shipments
//Order Desk API: Delete Shipments
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced
$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 = "";
//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_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