Request an order code examples
Bash:
# You can also use wget
curl -X PUT https://app.staging.shippit.com/api/3/orders/{tracking_number} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
HTTP:
PUT https://app.staging.shippit.com/api/3/orders/{tracking_number} HTTP/1.1
Host: app.staging.shippit.com
Content-Type: application/json
Accept: application/json
Javascript:
const inputBody = '{
"order": {
"authority_to_leave": "Yes",
"cash_on_delivery_amount": 0.0,
"courier_type": "standard",
"courier_allocation": "CouriersPlease",
"receiver_contact_number": "0400000000",
"receiver_name": "Receiver Name",
"receiver_language_code": "EN",
"retailer_invoice": "Retailer Invoice",
"retailer_reference": "Retailer Reference",
"product_currency": "AUD",
"suppress_communications": false,
"features": [],
"description": "",
"duties": 0.0,
"tax_amount": 0.0,
"customs_clearance_attributes": null,
"delivery_company": null,
"delivery_address": "1 Test Street",
"delivery_suburb": "Sydney",
"delivery_state": "NSW",
"delivery_postcode": "2000",
"delivery_country_code": "AU",
"delivery_timezone": "Australia/Sydney",
"delivery_instructions": "Leave on door",
"user_attributes": {
"email": "test@example.com",
"first_name": "Test",
"last_name": "Example",
"mobile": "0400000000"
},
"parcel_attributes": [
{
"qty": 1,
"length": 0.1,
"width": 0.2,
"depth": 0.3,
"weight": 20.0,
"label_number": "PARCELLABEL01"
}
],
"product_attributes": [
{
"price": 12.34,
"tariff_code": null,
"quantity": 1,
"title": null,
"sku": "12345",
"dangerous_goods_code": null,
"dangerous_goods_text": null,
"origin_country_code": "AU",
"product_line_id": null,
"location": null,
"dangerous_goods_class": null,
"packed": 1
}
]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://app.staging.shippit.com/api/3/orders',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
Ruby:
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.put 'https://app.staging.shippit.com/api/3/orders/{tracking_number}',
params: {
}, headers: headers
p JSON.parse(result)
Python:
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.put('https://app.staging.shippit.com/api/3/orders/{tracking_number}', headers = headers)
print(r.json())
PHP:
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','https://app.staging.shippit.com/api/3/orders/{tracking_number}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
Java:
URL obj = new URL("https://app.staging.shippit.com/api/3/orders/{tracking_number}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
Golang:
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://app.staging.shippit.com/api/3/orders/{tracking_number}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}