curl https://api.goshippo.com/shipments/ \
-H "Authorization: ShippoToken YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"address_from":{
"name":"Mr. Hippo",
"street1":"215 Clayton St.",
"city":"San Francisco",
"state":"CA",
"zip":"94117",
"country":"US",
"phone":"+1 555 341 9393",
"email":"[email protected]"
},
"address_to":{
"name":"Mrs. Hippo",
"street1":"965 Mission St.",
"city":"San Francisco",
"state":"CA",
"zip":"94105",
"country":"US",
"phone":"+1 555 341 9393",
"email":"[email protected]"
},
"parcels":[{
"length":"5",
"width":"5",
"height":"5",
"distance_unit":"in",
"weight":"2",
"mass_unit":"lb"
}],
"async": false
}'
require 'shippo'
Shippo::api_token = 'YOUR_API_KEY'
address_from = {
:name => 'Shawn Ippotle',
:street1 => '965 Mission St.',
:city => 'San Francisco',
:state => 'CA',
:zip => '94117',
:country => 'US',
:phone => '+1 555 341 9393',
:email => '[email protected]'
}
address_to = {
:name => 'Mr Hippo',
:street1 => 'Broadway 1',
:city => 'New York',
:state => 'NY',
:zip => '10007',
:country => 'US',
:phone => '+1 555 341 9393',
:email => '[email protected]'
}
parcel = {
:length => 5,
:width => 1,
:height => 5.555,
:distance_unit => :in,
:weight => 2,
:mass_unit => :lb
}
shipment = Shippo::Shipment.create(
:address_from => address_from,
:address_to => address_to,
:parcels => parcel,
:async => false
)
import shippo
shippo.api_key = "YOUR_API_KEY"
address_from = {
"name": "Shawn Ippotle",
"street1": "215 Clayton St.",
"city": "San Francisco",
"state": "CA",
"zip": "94117",
"country": "US",
"phone": "+1 555 341 9393",
"email": "[email protected]"
}
address_to = {
"name": "Mr Hippo",
"street1": "Broadway 1",
"city": "New York",
"state": "NY",
"zip": "10007",
"country": "US",
"phone": "+1 555 341 9393",
"email": "[email protected]"
}
parcel = {
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "lb"
}
shipment = shippo.Shipment.create(
address_from = address_from,
address_to = address_to,
parcels = [parcel],
async = False
)
require_once('lib/Shippo.php');
Shippo::setApiKey("YOUR_API_KEY");
$fromAddress = array(
'name' => 'Shawn Ippotle',
'street1' => '215 Clayton St.',
'city' => 'San Francisco',
'state' => 'CA',
'zip' => '94117',
'country' => 'US',
'phone' => '+1 555 341 9393',
'email' => '[email protected]'
);
$toAddress = array(
'name' => 'Mr Hippo"',
'street1' => 'Broadway 1',
'city' => 'New York',
'state' => 'NY',
'zip' => '10007',
'country' => 'US',
'phone' => '+1 555 341 9393',
'email' => '[email protected]'
);
$parcel = array(
'length'=> '5',
'width'=> '5',
'height'=> '5',
'distance_unit'=> 'in',
'weight'=> '2',
'mass_unit'=> 'lb',
);
$shipment = Shippo_Shipment::create( array(
'address_from'=> $fromAddress,
'address_to'=> $toAddress,
'parcels'=> array($parcel),
'async'=> false
)
);
var shippo = require('shippo')('YOUR_API_KEY');
var addressFrom = {
"name": "Shawn Ippotle",
"street1": "215 Clayton St.",
"city": "San Francisco",
"state": "CA",
"zip": "94117",
"country": "US",
"phone": "+1 555 341 9393",
"email": "[email protected]"
};
var addressTo = {
"name": "Mr Hippo",
"street1": "Broadway 1",
"city": "New York",
"state": "NY",
"zip": "10007",
"country": "US",
"phone": "+1 555 341 9393",
"email": "[email protected]"
};
var parcel = {
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "lb"
};
shippo.shipment.create({
"address_from": addressFrom,
"address_to": addressTo,
"parcels": [parcel],
"async": false
}, function(err, shipment){
// asynchronously called
});
Shippo.setApiKey('YOUR_API_KEY');
// To Address
HashMap<String, Object> addressToMap = new HashMap<String, Object>();
addressToMap.put("name", "Mr Hippo");
addressToMap.put("company", "Shippo");
addressToMap.put("street1", "215 Clayton St.");
addressToMap.put("city", "San Francisco");
addressToMap.put("state", "CA");
addressToMap.put("zip", "94117");
addressToMap.put("country", "US");
addressToMap.put("phone", "+1 555 341 9393");
addressToMap.put("email", "[email protected]");
// From Address
HashMap<String, Object> addressFromMap = new HashMap<String, Object>();
addressFromMap.put("name", "Ms Hippo");
addressFromMap.put("company", "San Diego Zoo");
addressFromMap.put("street1", "2920 Zoo Drive");
addressFromMap.put("city", "San Diego");
addressFromMap.put("state", "CA");
addressFromMap.put("zip", "92101");
addressFromMap.put("country", "US");
addressFromMap.put("email", "[email protected]");
addressFromMap.put("phone", "+1 619 231 1515");
addressFromMap.put("metadata", "Customer ID 123456");
// Parcel
HashMap<String, Object> parcelMap = new HashMap<String, Object>();
parcelMap.put("length", "5");
parcelMap.put("width", "5");
parcelMap.put("height", "5");
parcelMap.put("distance_unit", "in");
parcelMap.put("weight", "2");
parcelMap.put("mass_unit", "lb");
// Shipment
HashMap<String, Object> shipmentMap = new HashMap<String, Object>();
shipmentMap.put("address_to", addressToMap);
shipmentMap.put("address_from", addressFromMap);
shipmentMap.put("parcels", parcelMap);
shipmentMap.put("async", false);
Shipment shipment = Shipment.create(shipmentMap);
APIResource resource = new APIResource ('YOUR_API_KEY');
// to address
Hashtable toAddressTable = new Hashtable();
toAddressTable.Add("name", "Mr Hippo");
toAddressTable.Add("company", "Shippo");
toAddressTable.Add("street1", "215 Clayton St.");
toAddressTable.Add("city", "San Francisco");
toAddressTable.Add("state", "CA");
toAddressTable.Add("zip", "94117");
toAddressTable.Add("country", "US");
toAddressTable.Add("phone", "+1 555 341 9393");
toAddressTable.Add("email", "[email protected]");
// from address
Hashtable fromAddressTable = new Hashtable();
fromAddressTable.Add("name", "Ms Hippo");
fromAddressTable.Add("company", "San Diego Zoo");
fromAddressTable.Add("street1", "2920 Zoo Drive");
fromAddressTable.Add("city", "San Diego");
fromAddressTable.Add("state", "CA");
fromAddressTable.Add("zip", "92101");
fromAddressTable.Add("country", "US");
fromAddressTable.Add("email", "[email protected]");
fromAddressTable.Add("phone", "+1 619 231 1515");
fromAddressTable.Add("metadata", "Customer ID 123456");
Hashtable parcelTable = new Hashtable ();
parcelTable.Add ("length", "5");
parcelTable.Add ("width", "5");
parcelTable.Add ("height", "5");
parcelTable.Add ("distance_unit", "in");
parcelTable.Add ("weight", "2");
parcelTable.Add ("mass_unit", "lb");
resource.CreateShipment(new Hashtable(){
{ "address_to", toAddressTable},
{ "address_from", fromAddressTable},
{ "parcels", parcelTable},
{ "async", false}});