post https://api.easyship.com/rate/v1/rates
items array object | type | description |
---|---|---|
actual_weight | float | Actual weight of item in KG |
height | float | Actual height of item in cm |
width | float | Actual width of item in cm |
length | float | Actual length of item in cm |
category | string | Item's category. Allowed values= mobiles, tablets, computers_laptops, cameras, accessory_no_battery, accessory_battery, health_beauty, health_beauty_non_liquid, fashion, watches, home_appliances, home_decor, toys, sport, luggage, audio_video, documents, jewelry, dry_food_supplements, books_collectionables, pet_accessory, gaming. |
declared_currency | string | Items customs value currency: See supported currencies Must be uppercase |
declared_customs_value | float | Items customs value |
quantity | integer | Items quantity |
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer 4e2b327e2ef5471885cd0bc50a0c9fe52481793bd309b2c4f2a6bdac3f10ae1f" \
--data-binary "{
\"origin_postal_code\": \"WC2N\",
\"destination_country_alpha2\": \"US\",
\"destination_postal_code\": \"10030\",
\"taxes_duties_paid_by\": \"Sender\",
\"is_insured\": false,
\"items\": [
{
\"actual_weight\": 1.2,
\"height\": 10,
\"width\": 15,
\"length\": 20,
\"category\": \"mobiles\",
\"declared_currency\": \"SGD\",
\"declared_customs_value\": 100
}
]
}" \
'https://api.easyship.com/rate/v1/rates'
require 'uri'
require 'net/http'
url = URI("https://api.easyship.com/rate/v1/rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTPrequire 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
values = '{
"origin_country_alpha2": "SG",
"origin_postal_code": "WC2N",
"destination_country_alpha2": "US",
"destination_postal_code": "10030",
"taxes_duties_paid_by": "Sender",
"is_insured": false,
"items": [
{
"actual_weight": 1.2,
"height": 10,
"width": 15,
"length": 20,
"category": "mobiles",
"declared_currency": "SGD",
"declared_customs_value": 100
}
]
}'
headers = {
:content_type => 'application/json',
:authorization => 'Bearer 4e2b327e2ef5471885cd0bc50a0c9fe52481793bd309b2c4f2a6bdac3f10ae1f'
}
response = RestClient.post 'https://api.easyship.com/rate/v1/rates', values, headers
puts response.body
var request = require("request");
var options = { method: 'POST',
url: 'https://api.easyship.com/rate/v1/rates',
headers:
{
'cache-control': 'no-cache',
'authorization': 'Bearer XXXXXX',
'content-type': 'application/json',
'accept': 'application/json' },
body:
{ origin_country_alpha2: 'SG',
origin_postal_code: '45373',
origin_state: 'OH',
destination_country_alpha2: 'US',
destination_postal_code: '45373',
taxes_duties_paid_by: 'Receiver',
is_insured: true,
items:
[ { actual_weight: 0.170097,
height: 1,
width: 1,
length: 1,
category: 'documents',
declared_currency: 'USD',
declared_customs_value: 36.79 } ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
var request = new XMLHttpRequest();
request.open('POST', 'https://api.easyship.com/rate/v1/rates');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer 4e2b327e2ef5471885cd0bc50a0c9fe52481793bd309b2c4f2a6bdac3f10ae1f');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
var body = {
'origin_country_alpha2': 'SG',
'origin_postal_code': 'WC2N',
'destination_country_alpha2': 'US',
'destination_postal_code': '10030',
'taxes_duties_paid_by': 'Sender',
'is_insured': false,
'items': [
{
'actual_weight': 1.2,
'height': 10,
'width': 15,
'length': 20,
'category': 'mobiles',
'declared_currency': 'SGD',
'declared_customs_value': 100
}
]
};
request.send(JSON.stringify(body));
import requests
import json
values = """
{
"origin_country_alpha2": "SG",
"origin_postal_code": "WC2N",
"destination_country_alpha2": "US",
"destination_postal_code": "10030",
"taxes_duties_paid_by": "Sender",
"is_insured": false,
"items": [
{
"actual_weight": 1.2,
"height": 10,
"width": 15,
"length": 20,
"category": "mobiles",
"declared_currency": "SGD",
"declared_customs_value": 100
}
]
}
"""
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer 4e2b327e2ef5471885cd0bc50a0c9fe52481793bd309b2c4f2a6bdac3f10ae1f'
}
r = requests.post("https://api-sandbox.easyship.com/rate/v1/rates", data=values, headers=headers)
print(r.text)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.easyship.com/rate/v1/rates");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"origin_country_alpha2\": \"SG\",
\"origin_postal_code\": \"WC2N\",
\"destination_country_alpha2\": \"US\",
\"destination_postal_code\": \"10030\",
\"taxes_duties_paid_by\": \"Sender\",
\"is_insured\": false,
\"items\": [
{
\"actual_weight\": 1.2,
\"height\": 10,
\"width\": 15,
\"length\": 20,
\"category\": \"mobiles\",
\"declared_currency\": \"SGD\",
\"declared_customs_value\": 100
}
]
}");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Bearer 4e2b327e2ef5471885cd0bc50a0c9fe52481793bd309b2c4f2a6bdac3f10ae1f"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
"rates": [
{
"courier_id": "8ea55285-d53f-4b94-b788-17c4e5eefb5e",
"courier_name": "Singapore Post - ePack",
"min_delivery_time": 5,
"max_delivery_time": 7,
"value_for_money_rank": 2,
"delivery_time_rank": 7,
"shipment_charge": 30.38,
"fuel_surcharge": 0,
"remote_area_surcharge": null,
"shipment_charge_total": 30.38,
"warehouse_handling_fee": 0,
"insurance_fee": 0,
"ddp_handling_fee": 0,
"import_tax_charge": 0,
"import_duty_charge": 0,
"total_charge": 30.38,
"is_above_threshold": false,
"effective_incoterms": "DDU",
"estimated_import_tax": 0,
"estimated_import_duty": 0,
"courier_does_pickup": false,
"courier_dropoff_url": "https://www.easyship.com/drop-off/directlink/sg",
"tracking_rating": 2,
"payment_recipient": "Easyship",
"courier_remarks": null,
"currency": "SGD",
"box": {
"name": null,
"length": 20,
"width": 15,
"height": 10
},
"minimum_pickup_fee": 0,
"description": null,
"full_description": null
},
{
"courier_id": "16691987-a149-441b-a777-727ffe5c3325",
"courier_name": "UPS Worldwide Saver - Battery",
"min_delivery_time": 2,
"max_delivery_time": 5,
"value_for_money_rank": 1,
"delivery_time_rank": 4,
"shipment_charge": 52.08,
"fuel_surcharge": 5.859,
"remote_area_surcharge": 0,
"shipment_charge_total": 57.939,
"warehouse_handling_fee": 0,
"insurance_fee": 0,
"ddp_handling_fee": 0,
"import_tax_charge": 0,
"import_duty_charge": 0,
"total_charge": 57.94,
"is_above_threshold": false,
"effective_incoterms": "DDU",
"estimated_import_tax": 0,
"estimated_import_duty": 0,
"courier_does_pickup": true,
"courier_dropoff_url": null,
"tracking_rating": 3,
"payment_recipient": "Easyship",
"courier_remarks": null,
"currency": "SGD",
"box": {
"name": null,
"length": 20,
"width": 15,
"height": 10
},
"minimum_pickup_fee": 0,
"description": null,
"full_description": null
}
]
}