curl -iX POST https://api.shipengine.com/v1/rates \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"rate_options": {
"carrier_ids": [
"se-123890"
]
},
"shipment": {
"validate_address": "no_validation",
"ship_to": {
"name": "Amanda Miller",
"phone": "555-555-5555",
"address_line1": "525 S Winchester Blvd",
"city_locality": "San Jose",
"state_province": "CA",
"postal_code": "95128",
"country_code": "US",
"address_residential_indicator": "yes"
},
"ship_from": {
"company_name": "Example Corp.",
"name": "John Doe",
"phone": "111-111-1111",
"address_line1": "4009 Marathon Blvd",
"address_line2": "Suite 300",
"city_locality": "Austin",
"state_province": "TX",
"postal_code": "78756",
"country_code": "US",
"address_residential_indicator": "no"
},
"packages": [
{
"weight": {
"value": 1.0,
"unit": "ounce"
}
}
]
}
}'
POST /v1/rates HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"rate_options": {
"carrier_ids": [
"se-123890"
]
},
"shipment": {
"validate_address": "no_validation",
"ship_to": {
"name": "Amanda Miller",
"phone": "555-555-5555",
"address_line1": "525 S Winchester Blvd",
"city_locality": "San Jose",
"state_province": "CA",
"postal_code": "95128",
"country_code": "US",
"address_residential_indicator": "yes"
},
"ship_from": {
"company_name": "Example Corp.",
"name": "John Doe",
"phone": "111-111-1111",
"address_line1": "4009 Marathon Blvd",
"address_line2": "Suite 300",
"city_locality": "Austin",
"state_province": "TX",
"postal_code": "78756",
"country_code": "US",
"address_residential_indicator": "no"
},
"packages": [
{
"weight": {
"value": 1.0,
"unit": "ounce"
}
}
]
}
}
import requests url = “https://api.shipengine.com/v1/rates” payload = “{\n \”rate_options\”: {\n \”carrier_ids\”: [\n \”se-123890\”\n ]\n },\n \”shipment\”: {\n \”validate_address\”: \”no_validation\”,\n \”ship_to\”: {\n \”name\”: \”Amanda Miller\”,\n \”phone\”: \”555-555-5555\”,\n \”address_line1\”: \”525 S Winchester Blvd\”,\n \”city_locality\”: \”San Jose\”,\n \”state_province\”: \”CA\”,\n \”postal_code\”: \”95128\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”yes\”\n },\n \”ship_from\”: {\n \”company_name\”: \”Example Corp.\”,\n \”name\”: \”John Doe\”,\n \”phone\”: \”111-111-1111\”,\n \”address_line1\”: \”4009 Marathon Blvd\”,\n \”address_line2\”: \”Suite 300\”,\n \”city_locality\”: \”Austin\”,\n \”state_province\”: \”TX\”,\n \”postal_code\”: \”78756\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”no\”\n },\n \”packages\”: [\n {\n \”weight\”: {\n \”value\”: 1.0,\n \”unit\”: \”ounce\”\n }\n }\n ]\n }\n}” headers = { ‘Host’: ‘api.shipengine.com’, ‘API-Key’: ‘__YOUR_API_KEY_HERE__’, ‘Content-Type’: ‘application/json’ } response = requests.request(“POST”, url, headers=headers, data = payload) print(response.text.encode(‘utf8’))
require “uri” require “net/http” url = URI(“https://api.shipengine.com/v1/rates”) https = Net::HTTP.new(url.host, url.port); https.use_ssl = true request = Net::HTTP::Post.new(url) request[“Host”] = “api.shipengine.com” request[“API-Key”] = “__YOUR_API_KEY_HERE__” request[“Content-Type”] = “application/json” request.body = “{\n \”rate_options\”: {\n \”carrier_ids\”: [\n \”se-123890\”\n ]\n },\n \”shipment\”: {\n \”validate_address\”: \”no_validation\”,\n \”ship_to\”: {\n \”name\”: \”Amanda Miller\”,\n \”phone\”: \”555-555-5555\”,\n \”address_line1\”: \”525 S Winchester Blvd\”,\n \”city_locality\”: \”San Jose\”,\n \”state_province\”: \”CA\”,\n \”postal_code\”: \”95128\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”yes\”\n },\n \”ship_from\”: {\n \”company_name\”: \”Example Corp.\”,\n \”name\”: \”John Doe\”,\n \”phone\”: \”111-111-1111\”,\n \”address_line1\”: \”4009 Marathon Blvd\”,\n \”address_line2\”: \”Suite 300\”,\n \”city_locality\”: \”Austin\”,\n \”state_province\”: \”TX\”,\n \”postal_code\”: \”78756\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”no\”\n },\n \”packages\”: [\n {\n \”weight\”: {\n \”value\”: 1.0,\n \”unit\”: \”ounce\”\n }\n }\n ]\n }\n}” response = https.request(request) puts response.read_body
var client = new RestClient(“https://api.shipengine.com/v1/rates”); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader(“Host”, “api.shipengine.com”); request.AddHeader(“API-Key”, “__YOUR_API_KEY_HERE__”); request.AddHeader(“Content-Type”, “application/json”); request.AddParameter(“application/json”, “{\n \”rate_options\”: {\n \”carrier_ids\”: [\n \”se-123890\”\n ]\n },\n \”shipment\”: {\n \”validate_address\”: \”no_validation\”,\n \”ship_to\”: {\n \”name\”: \”Amanda Miller\”,\n \”phone\”: \”555-555-5555\”,\n \”address_line1\”: \”525 S Winchester Blvd\”,\n \”city_locality\”: \”San Jose\”,\n \”state_province\”: \”CA\”,\n \”postal_code\”: \”95128\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”yes\”\n },\n \”ship_from\”: {\n \”company_name\”: \”Example Corp.\”,\n \”name\”: \”John Doe\”,\n \”phone\”: \”111-111-1111\”,\n \”address_line1\”: \”4009 Marathon Blvd\”,\n \”address_line2\”: \”Suite 300\”,\n \”city_locality\”: \”Austin\”,\n \”state_province\”: \”TX\”,\n \”postal_code\”: \”78756\”,\n \”country_code\”: \”US\”,\n \”address_residential_indicator\”: \”no\”\n },\n \”packages\”: [\n {\n \”weight\”: {\n \”value\”: 1.0,\n \”unit\”: \”ounce\”\n }\n }\n ]\n }\n}”, ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);