{"_id":"58112e72ded0340f0085d039","__v":0,"category":{"_id":"58112e72ded0340f0085d032","project":"551e85be610f400d00837db7","__v":0,"version":"58112e71ded0340f0085d02a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-17T19:28:09.961Z","from_sync":false,"order":7,"slug":"merchant-api-methods","title":"Merchant API Methods"},"version":{"_id":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":4,"createdAt":"2016-10-26T22:30:09.862Z","releaseDate":"2016-10-26T22:30:09.862Z","categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"new designer","version_clean":"2.0.0","version":"2.0"},"user":"55f2fd49b5b25021002b7dfd","parentDoc":null,"project":"551e85be610f400d00837db7","updates":["57e01a2d80aef10e00899121"],"next":{"pages":[],"description":""},"createdAt":"2015-09-25T17:42:23.520Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":8,"body":"The following methods operate on the [Shipment data model](http://docs.cratejoy.com/docs/shipment).\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method put\\\">PUT</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}/\\n  </span>\\n</div>\"\n}\n[/block]\n\n# List Shipments\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/shipments/',\\n    method: 'GET'\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"List\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"count\\\": 1,\\n  \\\"next\\\": null,\\n  \\\"prev\\\": null,\\n  \\\"results\\\": [\\n    {\\n      \\\"adjusted_ordered_at\\\": \\\"2015-08-15T20:00:24Z\\\", \\n      \\\"created_at\\\": \\\"2015-07-15T20:00:24Z\\\", \\n      \\\"customer\\\": {...}, // Customer relation property \\n      \\\"customer_id\\\": 75561862,\\n      \\\"fulfillments\\\": {...}, // Fulfillments relation property\\n      \\\"id\\\": 75562100, \\n      \\\"is_gift\\\": false,\\n      \\\"is_test\\\": true, \\n      \\\"labels\\\": {...}, // Labels relation property \\n      \\\"ship_address\\\": {...}, // Ship_Address relation property\\n      \\\"shipped_at\\\": null, \\n      \\\"status\\\": \\\"unshipped\\\",\\n      \\\"target_at\\\": \\\"2017-02-13T14:51:28Z\\\",\\n      \\\"tracking_number\\\": null, \\n      \\\"type\\\": \\\"shipment\\\",\\n      \\\"url\\\": \\\"/v1/shipments/62619521654545/\\n    }\\n }\",\n      \"language\": \"json\",\n      \"name\": \"Loaded relations\"\n    },\n    {\n      \"code\": \"{\\n  \\\"adjusted_ordered_at\\\": 1440478800000, \\n  \\\"created_at\\\": 1440478800000, \\n  \\\"customer\\\": \\\"/v1/customers/75561862\\\", \\n  \\\"fulfillments\\\": \\\"/v1/shipments/75562100/fulfillments\\\", \\n  \\\"id\\\": 75562100, \\n  \\\"is_test\\\": true, \\n  \\\"labels\\\": \\\"/v1/shipments/75562100/labels\\\", \\n  \\\"ship_address\\\": \\\"/v1/shipments/75562100/ship_address\\\", \\n  \\\"shipped_at\\\": null, \\n  \\\"status\\\": \\\"unshipped\\\", \\n  \\\"target_at\\\": 1440478800000, \\n  \\\"tracking_number\\\": null, \\n  \\\"type\\\": \\\"shipment\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Relation as urls\"\n    }\n  ]\n}\n[/block]\n# Get a shipment\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\\n    method: 'GET'\\n});\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n# Update a shipment\n\nFor more details on updating a shipment to include tracking information, check out [Adding Tracking to a Shipment.](http://docs.cratejoy.com/docs/quick-start-add-a-tracking-number-to-a-shipment) \n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method put\\\">PUT</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\\n    method: 'PUT',\\n    data: {\\n        shipped_at: \\\"2015-09-01T12:30:00Z\\\",\\n        adjusted_ordered_at: \\\"2015-08-25 00:00:00Z\\\",\\n        tracking_number: \\\"D2FA3GA57H0NDSF9FAE8G6AR3H4ATJ7HSD8FBXFG\\\",\\n        status: \\\"shipped\\\"\\n    },\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Example\"\n    },\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\\n    headers: {\\n        // Optional: Product feedback enabled settings, true or false.\\n      \\t'X-Cratejoy-ProductFeedback-Enabled': true,\\n      \\t// Optional: Product feedback interval.\\n        'X-Cratejoy-ProductFeedback-Interval': 15\\n    },\\n    method: 'PUT',\\n    data: {\\n        shipped_at: \\\"2015-09-01T12:30:00Z\\\",\\n        adjusted_ordered_at: \\\"2015-08-25 00:00:00Z\\\",\\n        tracking_number: \\\"1Z9999999999999999\\\",\\n        status: \\\"shipped\\\"\\n    },\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Example - Setting Product Feedback Settings\"\n    }\n  ]\n}\n[/block]\nFor a complete list of writable properties, see the [Shipment data model](doc:shipment) .\n\n# Shipment Metadata\n\nThe following methods operate on the [Shipment Metadata](doc:shipment-metadata) subresource.\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method post\\\">POST</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method delete\\\">DELETE</span>\\n  <span class=\\\"uri\\\">\\n    http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\\n  </span>\\n</div>\"\n}\n[/block]","excerpt":"Shipment methods for the Cratejoy Merchant API","slug":"shipment-methods-1","type":"basic","title":"Shipment Methods"}

Shipment Methods

Shipment methods for the Cratejoy Merchant API

The following methods operate on the [Shipment data model](http://docs.cratejoy.com/docs/shipment). [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/\n </span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}\n </span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}/\n </span>\n</div>" } [/block] # List Shipments [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/shipments/',\n method: 'GET'\n});", "language": "javascript", "name": "List" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"count\": 1,\n \"next\": null,\n \"prev\": null,\n \"results\": [\n {\n \"adjusted_ordered_at\": \"2015-08-15T20:00:24Z\", \n \"created_at\": \"2015-07-15T20:00:24Z\", \n \"customer\": {...}, // Customer relation property \n \"customer_id\": 75561862,\n \"fulfillments\": {...}, // Fulfillments relation property\n \"id\": 75562100, \n \"is_gift\": false,\n \"is_test\": true, \n \"labels\": {...}, // Labels relation property \n \"ship_address\": {...}, // Ship_Address relation property\n \"shipped_at\": null, \n \"status\": \"unshipped\",\n \"target_at\": \"2017-02-13T14:51:28Z\",\n \"tracking_number\": null, \n \"type\": \"shipment\",\n \"url\": \"/v1/shipments/62619521654545/\n }\n }", "language": "json", "name": "Loaded relations" }, { "code": "{\n \"adjusted_ordered_at\": 1440478800000, \n \"created_at\": 1440478800000, \n \"customer\": \"/v1/customers/75561862\", \n \"fulfillments\": \"/v1/shipments/75562100/fulfillments\", \n \"id\": 75562100, \n \"is_test\": true, \n \"labels\": \"/v1/shipments/75562100/labels\", \n \"ship_address\": \"/v1/shipments/75562100/ship_address\", \n \"shipped_at\": null, \n \"status\": \"unshipped\", \n \"target_at\": 1440478800000, \n \"tracking_number\": null, \n \"type\": \"shipment\"\n}", "language": "json", "name": "Relation as urls" } ] } [/block] # Get a shipment [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\n method: 'GET'\n});", "language": "javascript", "name": null } ] } [/block] # Update a shipment For more details on updating a shipment to include tracking information, check out [Adding Tracking to a Shipment.](http://docs.cratejoy.com/docs/quick-start-add-a-tracking-number-to-a-shipment) [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}/\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\n method: 'PUT',\n data: {\n shipped_at: \"2015-09-01T12:30:00Z\",\n adjusted_ordered_at: \"2015-08-25 00:00:00Z\",\n tracking_number: \"D2FA3GA57H0NDSF9FAE8G6AR3H4ATJ7HSD8FBXFG\",\n status: \"shipped\"\n },\n});", "language": "javascript", "name": "Example" }, { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\n headers: {\n // Optional: Product feedback enabled settings, true or false.\n \t'X-Cratejoy-ProductFeedback-Enabled': true,\n \t// Optional: Product feedback interval.\n 'X-Cratejoy-ProductFeedback-Interval': 15\n },\n method: 'PUT',\n data: {\n shipped_at: \"2015-09-01T12:30:00Z\",\n adjusted_ordered_at: \"2015-08-25 00:00:00Z\",\n tracking_number: \"1Z9999999999999999\",\n status: \"shipped\"\n },\n});", "language": "javascript", "name": "Example - Setting Product Feedback Settings" } ] } [/block] For a complete list of writable properties, see the [Shipment data model](doc:shipment) . # Shipment Metadata The following methods operate on the [Shipment Metadata](doc:shipment-metadata) subresource. [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\n </span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method post\">POST</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\n </span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method delete\">DELETE</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/\n </span>\n</div>" } [/block]