Skip to content

Instantly share code, notes, and snippets.

@schof
Created January 11, 2010 23:16
Show Gist options
  • Save schof/274712 to your computer and use it in GitHub Desktop.
Save schof/274712 to your computer and use it in GitHub Desktop.
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" http://localhost:3000/api/orders
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" http://localhost:3000/api/orders?search[number]=R664048424 --globoff -i
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6"
http://localhost:3000/api/orders/1035625630
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" http://localhost:3000/api/orders/1035625630/shipments
# create new shipment for order (assumes you know shipping method id - no inventory units)
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" -X POST http://localhost:3000/api/orders/1035625630/shipments --globoff -i -d {"shipment":{"shipping_method_id":574015644},"shipped_at":null,"cost":5.0,"tracking":"FEDEX-TRACK123","address":{"city":"North Serenahaven","address1":"6957 Alyce Wells","address2":"Apt. 741","zipcode":"16804","country_id":214,"state_name":null,"lastname":"Nikolaus","phone":"502-510-7481 x3973","firstname":"Vallie","state_id":889445952,"alternative_phone":null},"inventory_units":[],"state":"shipped"}
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" --globoff -i -d {"shipment":{"shipping_method_id":574015644},"shipped_at":null,"cost":5.0,"tracking":"FEDEX-TRACK123","address":{"city":"North Serenahaven","address1":"6957 Alyce Wells","address2":"Apt. 741","zipcode":"16804","country_id":214,"state_name":null,"lastname":"Nikolaus","phone":"502-510-7481 x3973","firstname":"Vallie","state_id":889445952,"alternative_phone":null},"inventory_units":[],"state":"shipped"} -X POST http://localhost:3000/api/orders/1035625630/shipments
curl -H "Content-Type:application/json" -H "Accept:application/json" -H "X-SpreeAPIKey: 164472af75abf6bb02a7b83ff1bed852852252b6" --globoff -i -X POST http://localhost:3000/api/orders/1035625630/shipments -d '
{
"shipment": {
"shipping_method_id": 574015644,
"shipped_at": null,
"cost": 5.0,
"tracking": "FEDEX-TRACK123",
"address_attributes": {
"city": "North Serenahaven",
"address1": "6957 Alyce Wells",
"address2": "Apt. 741",
"zipcode": "16804",
"country_id": 214,
"state_name": null,
"lastname": "Nikolaus",
"phone": "502-510-7481 x3973",
"firstname": "Vallie",
"state_id": 889445952,
"alternative_phone": null
},
"inventory_units": [
],
"state": "shipped"
}
}'
# fire event transition
curl -i -X PUT -H "X-SpreeAPIKey: 9c29748664de73fa20d904f0e6d748d89194a88a" http://localhost:3000/api/shipments/1062711834/event?e=transmit
# list shipment
curl -H "X-SpreeAPIKey: 9c29748664de73fa20d904f0e6d748d89194a88a" -i http://localhost:3000/api/shipments/1062711834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment