curl --request POST \
    --url https://api.easyship.com/v2/shipments \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer paste your token here' \
    --header 'Content-Type: application/json' \
    --data '{
        "incoterms": "DDU",
        "insurance": {
            "is_insured": false
        },
        "courier_selection": {
            "allow_courier_fallback": false,
            "apply_shipping_rules": true
        },
        "shipping_settings": {
            "units": {
                "weight": "kg",
                "dimensions": "cm"
            },
            "buy_label": false,
            "buy_label_synchronous": false,
            "printing_options": {
                "format": "png",
                "label": "4x6",
                "commercial_invoice": "A4",
                "packing_slip": "4x6"
            }
        }
    }'
    
 
    
    
const fetch = require('node-fetch');
const url = 'https://api.easyship.com/v2/shipments';
const options = {
    method: 'POST',
    headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
        Authorization: 'Bearer paste your token here'
    },
    body: JSON.stringify({
        incoterms: 'DDU',
        insurance: {is_insured: false},
        courier_selection: {allow_courier_fallback: false, apply_shipping_rules: true},
        shipping_settings: {
            units: {weight: 'kg', dimensions: 'cm'},
            buy_label: false,
            buy_label_synchronous: false,
            printing_options: {format: 'png', label: '4x6', commercial_invoice: 'A4', packing_slip: '4x6'}
        }
    })
};
fetch(url, options)
    .then(res => res.json())
    .then(json => console.log(json))
    .catch(err => console.error('error:' + err));
    
     
    
        
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.easyship.com/v2/shipments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer paste your token here'
request.body = "{\"incoterms\":\"DDU\",\"insurance\":{\"is_insured\":false},\"courier_selection\":{\"allow_courier_fallback\":false,\"apply_shipping_rules\":true},\"shipping_settings\":{\"units\":{\"weight\":\"kg\",\"dimensions\":\"cm\"},\"buy_label\":false,\"buy_label_synchronous\":false,\"printing_options\":{\"format\":\"png\",\"label\":\"4x6\",\"commercial_invoice\":\"A4\",\"packing_slip\":\"4x6\"}}}"
response = http.request(request)
puts response.read_body
    
     
    
     
 "https://api.easyship.com/v2/shipments",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\"incoterms\":\"DDU\",\"insurance\":{\"is_insured\":false},\"courier_selection\":{\"allow_courier_fallback\":false,\"apply_shipping_rules\":true},\"shipping_settings\":{\"units\":{\"weight\":\"kg\",\"dimensions\":\"cm\"},\"buy_label\":false,\"buy_label_synchronous\":false,\"printing_options\":{\"format\":\"png\",\"label\":\"4x6\",\"commercial_invoice\":\"A4\",\"packing_slip\":\"4x6\"}}}",
    CURLOPT_HTTPHEADER => [
        "Accept: application/json",
        "Authorization: Bearer paste your token here",
        "Content-Type: application/json"
    ],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
    
     
    
    
    
    import requests
url = "https://api.easyship.com/v2/shipments"
payload = {
    "incoterms": "DDU",
    "insurance": {"is_insured": False},
    "courier_selection": {
        "allow_courier_fallback": False,
        "apply_shipping_rules": True
    },
    "shipping_settings": {
        "units": {
            "weight": "kg",
            "dimensions": "cm"
        },
        "buy_label": False,
        "buy_label_synchronous": False,
        "printing_options": {
            "format": "png",
            "label": "4x6",
            "commercial_invoice": "A4",
            "packing_slip": "4x6"
        }
    }
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer paste your token here"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)