{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Address Methods","type":"basic","slug":"customer-address-methods","excerpt":"Customer Address data object specification for the Cratejoy Merchant API","body":"The following methods operate on the [Address data model](doc:customeraddress).  See the [Customer Methods](doc:methods-customer) to understand how to find the address for a customer.\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}</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    https://api.cratejoy.com/v1/addresses/{address_id}/</span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method post\\\">POST</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}/</span>\\n</div>\"\n}\n[/block]\n\n# Get an address\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}</span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({     \\n  url: 'https://api.cratejoy.com/v1/addresses/75562247/',\\n  method: 'GET'\\n});\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"city\\\": \\\"Austin\\\", \\n  \\\"company\\\": \\\"\\\", \\n  \\\"country\\\": \\\"US\\\", \\n  \\\"icon\\\": \\\"United-States.png\\\", \\n  \\\"id\\\": 75562247, \\n  \\\"phone_number\\\": \\\"\\\", \\n  \\\"state\\\": \\\"TX\\\", \\n  \\\"status\\\": 0, \\n  \\\"status_message\\\": null, \\n  \\\"street\\\": \\\"101 Main St\\\", \\n  \\\"to\\\": \\\"James Taylor\\\", \\n  \\\"type\\\": \\\"address\\\", \\n  \\\"unit\\\": \\\"\\\", \\n  \\\"zip_code\\\": \\\"78701\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response: 200 OK\"\n    }\n  ]\n}\n[/block]\n# Update an address\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method put\\\">PUT</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}/</span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/addresses/75562247/',\\n    method: 'PUT',\\n    data: {\\n      street: \\\"2012 Northridge Dr\\\",\\n      zip_code: \\\"78723\\\"\\n    }\\n});\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"city\\\": \\\"Austin\\\", \\n  \\\"company\\\": \\\"\\\", \\n  \\\"country\\\": \\\"US\\\", \\n  \\\"icon\\\": \\\"United-States.png\\\", \\n  \\\"id\\\": 75562247, \\n  \\\"phone_number\\\": \\\"\\\", \\n  \\\"state\\\": \\\"TX\\\", \\n  \\\"status\\\": 0, \\n  \\\"status_message\\\": null, \\n  \\\"street\\\": \\\"2012 Northridge Dr\\\", \\n  \\\"to\\\": \\\"James Taylor\\\", \\n  \\\"type\\\": \\\"address\\\", \\n  \\\"unit\\\": \\\"\\\", \\n  \\\"zip_code\\\": \\\"78723\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response: 200 OK\"\n    }\n  ]\n}\n[/block]\n\n\n\nThe following methods operate on the [Address data model](doc:customeraddress).  See the [Customer Methods](doc:methods-customer) to understand how to find the address for a customer.\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method get\\\">GET</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}</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    https://api.cratejoy.com/v1/addresses/{address_id}/</span>\\n</div>\"\n}\n[/block]\n\n# Create an address\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  <span class=\\\"method post\\\">POST</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/addresses/{address_id}/</span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n    url: 'https://api.cratejoy.com/v1/addresses/',\\n    method: 'PUT',\\n    data: {\\n      customer_id: \\\"12345\\\",\\n      to: \\\"James Taylor\\\",\\n      street: \\\"2012 Northridge Dr\\\",\\n      zip_code: \\\"78723\\\",\\n      state: \\\"TX\\\",\\n      country: \\\"US\\\"\\n    }\\n});\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"city\\\": \\\"Austin\\\", \\n  \\\"company\\\": \\\"\\\", \\n  \\\"country\\\": \\\"US\\\", \\n  \\\"icon\\\": \\\"United-States.png\\\", \\n  \\\"id\\\": 75562247, \\n  \\\"phone_number\\\": \\\"\\\", \\n  \\\"state\\\": \\\"TX\\\", \\n  \\\"status\\\": 0, \\n  \\\"status_message\\\": null, \\n  \\\"street\\\": \\\"2012 Northridge Dr\\\", \\n  \\\"to\\\": \\\"James Taylor\\\", \\n  \\\"type\\\": \\\"address\\\", \\n  \\\"unit\\\": \\\"\\\", \\n  \\\"zip_code\\\": \\\"78723\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response: 200 OK\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"58112e72ded0340f0085d037","user":"55f2fd49b5b25021002b7dfd","__v":0,"project":"551e85be610f400d00837db7","version":{"version":"2.0","version_clean":"2.0.0","codename":"new designer","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"_id":"58112e71ded0340f0085d02a","createdAt":"2016-10-26T22:30:09.862Z","project":"551e85be610f400d00837db7","releaseDate":"2016-10-26T22:30:09.862Z","__v":4},"githubsync":"","createdAt":"2015-09-25T15:18:14.294Z","parentDoc":null,"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Merchant API Methods","slug":"merchant-api-methods","order":7,"from_sync":false,"reference":false,"_id":"58112e72ded0340f0085d032","project":"551e85be610f400d00837db7","__v":0,"version":"58112e71ded0340f0085d02a","createdAt":"2015-08-17T19:28:09.961Z"}}

Address Methods

Customer Address data object specification for the Cratejoy Merchant API

The following methods operate on the [Address data model](doc:customeraddress). See the [Customer Methods](doc:methods-customer) to understand how to find the address for a customer. [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}</span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}/</span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method post\">POST</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}/</span>\n</div>" } [/block] # Get an address [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}</span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({ \n url: 'https://api.cratejoy.com/v1/addresses/75562247/',\n method: 'GET'\n});", "language": "javascript", "name": null } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"city\": \"Austin\", \n \"company\": \"\", \n \"country\": \"US\", \n \"icon\": \"United-States.png\", \n \"id\": 75562247, \n \"phone_number\": \"\", \n \"state\": \"TX\", \n \"status\": 0, \n \"status_message\": null, \n \"street\": \"101 Main St\", \n \"to\": \"James Taylor\", \n \"type\": \"address\", \n \"unit\": \"\", \n \"zip_code\": \"78701\"\n}", "language": "json", "name": "Response: 200 OK" } ] } [/block] # Update an address [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}/</span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/addresses/75562247/',\n method: 'PUT',\n data: {\n street: \"2012 Northridge Dr\",\n zip_code: \"78723\"\n }\n});", "language": "javascript", "name": null } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"city\": \"Austin\", \n \"company\": \"\", \n \"country\": \"US\", \n \"icon\": \"United-States.png\", \n \"id\": 75562247, \n \"phone_number\": \"\", \n \"state\": \"TX\", \n \"status\": 0, \n \"status_message\": null, \n \"street\": \"2012 Northridge Dr\", \n \"to\": \"James Taylor\", \n \"type\": \"address\", \n \"unit\": \"\", \n \"zip_code\": \"78723\"\n}", "language": "json", "name": "Response: 200 OK" } ] } [/block] The following methods operate on the [Address data model](doc:customeraddress). See the [Customer Methods](doc:methods-customer) to understand how to find the address for a customer. [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}</span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}/</span>\n</div>" } [/block] # Create an address [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method post\">POST</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/addresses/{address_id}/</span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n url: 'https://api.cratejoy.com/v1/addresses/',\n method: 'PUT',\n data: {\n customer_id: \"12345\",\n to: \"James Taylor\",\n street: \"2012 Northridge Dr\",\n zip_code: \"78723\",\n state: \"TX\",\n country: \"US\"\n }\n});", "language": "javascript", "name": null } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"city\": \"Austin\", \n \"company\": \"\", \n \"country\": \"US\", \n \"icon\": \"United-States.png\", \n \"id\": 75562247, \n \"phone_number\": \"\", \n \"state\": \"TX\", \n \"status\": 0, \n \"status_message\": null, \n \"street\": \"2012 Northridge Dr\", \n \"to\": \"James Taylor\", \n \"type\": \"address\", \n \"unit\": \"\", \n \"zip_code\": \"78723\"\n}", "language": "json", "name": "Response: 200 OK" } ] } [/block]