{"_id":"58112e72ded0340f0085d045","__v":0,"category":{"_id":"58112e72ded0340f0085d031","__v":0,"project":"551e85be610f400d00837db7","version":"58112e71ded0340f0085d02a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-24T22:11:45.789Z","from_sync":false,"order":5,"slug":"merchant-api","title":"Merchant API"},"parentDoc":null,"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"},"project":"551e85be610f400d00837db7","user":"55253acaf0f4610d00f7193f","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-24T22:12:17.281Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"## Adding tracking to a shipment\n\nThis snippet uses the /shipments/ PUT endpoint to add a tracking number to a shipment (and send a notification email to the customer).\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\": null\n    }\n  ]\n}\n[/block]\n#### Notes \n\n- On Line 7, with `tracking_number:` , we're adding a tracking number. \n- On Line 8, with `status: \"shipped\" `, we're changing the status of shi**pment to shipped, which will trigger the notification to the customer.**\n\n\n## Shipment-level product feedback settings\n\nIn the Cratejoy interface, admins can set [store-level product feedback settings](https://help.cratejoy.com/hc/en-us/articles/211063503-Product-Feedback-101). Setting shipment-level product feedback settings will override any store-level product feedback settings. \n\nTo set shipment-level settings, include `X-Cratejoy-ProductFeedback-Enabled` (true or false) and/or `X-Cratejoy-ProductFeedback-Interval` (the number of days after which the feedback survey should be sent) in the headers, like below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\\n    headers: {\\n        // Header should also contain authorization.\\n        'X-Cratejoy-ProductFeedback-Enabled': true,\\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    }\n  ]\n}\n[/block]\nThe response will not include confirmation that the feedback survey and interval settings were set, but users can see scheduled product feedback surveys in the Analytics > Notifications page in the Cratejoy interface.\n\n\n## How shipment-level product feedback settings interact with store-level settings##\nShipment-level product feedback settings will always override store-level settings. In the absence of shipment-level settings, the default is store-level settings, like below.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/01e59b2-ProductFeedbackAPISettings.png\",\n        \"ProductFeedbackAPISettings.png\",\n        1246,\n        666,\n        \"#d7dace\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"quick-start-add-a-tracking-number-to-a-shipment","type":"basic","title":"Add Tracking to a Shipment"}

Add Tracking to a Shipment


## Adding tracking to a shipment This snippet uses the /shipments/ PUT endpoint to add a tracking number to a shipment (and send a notification email to the customer). [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": null } ] } [/block] #### Notes - On Line 7, with `tracking_number:` , we're adding a tracking number. - On Line 8, with `status: "shipped" `, we're changing the status of shi**pment to shipped, which will trigger the notification to the customer.** ## Shipment-level product feedback settings In the Cratejoy interface, admins can set [store-level product feedback settings](https://help.cratejoy.com/hc/en-us/articles/211063503-Product-Feedback-101). Setting shipment-level product feedback settings will override any store-level product feedback settings. To set shipment-level settings, include `X-Cratejoy-ProductFeedback-Enabled` (true or false) and/or `X-Cratejoy-ProductFeedback-Interval` (the number of days after which the feedback survey should be sent) in the headers, like below. [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',\n headers: {\n // Header should also contain authorization.\n 'X-Cratejoy-ProductFeedback-Enabled': true,\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" } ] } [/block] The response will not include confirmation that the feedback survey and interval settings were set, but users can see scheduled product feedback surveys in the Analytics > Notifications page in the Cratejoy interface. ## How shipment-level product feedback settings interact with store-level settings## Shipment-level product feedback settings will always override store-level settings. In the absence of shipment-level settings, the default is store-level settings, like below. [block:image] { "images": [ { "image": [ "https://files.readme.io/01e59b2-ProductFeedbackAPISettings.png", "ProductFeedbackAPISettings.png", 1246, 666, "#d7dace" ] } ] } [/block]