{"_id":"58112e72ded0340f0085d040","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"},"project":"551e85be610f400d00837db7","user":"55f2fd49b5b25021002b7dfd","__v":0,"parentDoc":null,"updates":["56f4128b0f1f970e006e2482"],"next":{"pages":[],"description":""},"createdAt":"2015-09-25T19:04:04.050Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":13,"body":"See [Web Hook](doc:hook) documentation for information about web hooks.\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/hooks/\\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/hooks/{hook_id}/\\n  </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/hooks/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint list\\\">\\n  <span class=\\\"method delete\\\">DELETE</span>\\n  <span class=\\\"uri\\\">\\n    https://api.cratejoy.com/v1/hooks/{hook_id}/\\n  </span>\\n</div>\"\n}\n[/block]\n\n# List hooks\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/hooks/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.get(\\\"https://api.cratejoy.com/v1/hooks\\\");\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"count\\\": 1, \\n  \\\"next\\\": \\\"?page=1\\\", \\n  \\\"prev\\\": null, \\n  \\\"results\\\": [\\n    {\\n      \\\"created_at\\\": \\\"Fri, 18 Sep 2015 14:14:30 GMT\\\", \\n      \\\"enabled\\\": true, \\n      \\\"event\\\": \\\"customer_new\\\", \\n      \\\"id\\\": 75572246, \\n      \\\"name\\\": \\\"Test hook\\\", \\n      \\\"querystring\\\": null, \\n      \\\"request_type\\\": \\\"get\\\", \\n      \\\"store_id\\\": 4848355, \\n      \\\"target\\\": \\\"https://my.website.com/new_customer\\\", \\n      \\\"type\\\": \\\"hook\\\", \\n      \\\"url\\\": \\\"/v1/hooks/75572246/\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n# Update a hook\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/hooks/{hook_id}/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.ajax({\\n  method: 'PUT',\\n  url: 'https://api.cratejoy.com/v1/hooks/75572246/',\\n  data: {\\\"target\\\": \\\"http://my.newsite.com/\\\"},\\n  contentType: 'application/json'\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n_See the [Web Hook](doc:hook) documentation for a complete list of writeable properties._\n#Create a new webhook\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/hooks/\\n  </span>\\n</div>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.post(\\\"https://api.cratejoy.com/v1/hooks/\\\",{\\n  \\t\\\"name\\\":\\\"Test hook\\\",\\n\\t\\t\\\"target\\\":\\\"https://my.website.com/new_customer\\\",\\n\\t\\t\\\"request_type\\\": \\\"GET\\\",\\n\\t\\t\\\"event\\\": \\\"customer_new\\\"\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n_See the [Web Hook](doc:hook) documentation for a complete list of writeable properties._","excerpt":"","slug":"web-hook-methods","type":"basic","title":"Web Hook Methods"}
See [Web Hook](doc:hook) documentation for information about web hooks. [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n http://api.cratejoy.com/v1/hooks/\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/hooks/{hook_id}/\n </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/hooks/\n </span>\n</div>" } [/block] [block:html] { "html": "<div class=\"endpoint list\">\n <span class=\"method delete\">DELETE</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/hooks/{hook_id}/\n </span>\n</div>" } [/block] # List hooks [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method get\">GET</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/hooks/\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.get(\"https://api.cratejoy.com/v1/hooks\");", "language": "javascript" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"count\": 1, \n \"next\": \"?page=1\", \n \"prev\": null, \n \"results\": [\n {\n \"created_at\": \"Fri, 18 Sep 2015 14:14:30 GMT\", \n \"enabled\": true, \n \"event\": \"customer_new\", \n \"id\": 75572246, \n \"name\": \"Test hook\", \n \"querystring\": null, \n \"request_type\": \"get\", \n \"store_id\": 4848355, \n \"target\": \"https://my.website.com/new_customer\", \n \"type\": \"hook\", \n \"url\": \"/v1/hooks/75572246/\"\n }\n ]\n}", "language": "json" } ] } [/block] # Update a hook [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method put\">PUT</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/hooks/{hook_id}/\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.ajax({\n method: 'PUT',\n url: 'https://api.cratejoy.com/v1/hooks/75572246/',\n data: {\"target\": \"http://my.newsite.com/\"},\n contentType: 'application/json'\n});", "language": "javascript" } ] } [/block] _See the [Web Hook](doc:hook) documentation for a complete list of writeable properties._ #Create a new webhook [block:html] { "html": "<div class=\"endpoint\">\n <span class=\"method post\">POST</span>\n <span class=\"uri\">\n https://api.cratejoy.com/v1/hooks/\n </span>\n</div>" } [/block] [block:code] { "codes": [ { "code": "$.post(\"https://api.cratejoy.com/v1/hooks/\",{\n \t\"name\":\"Test hook\",\n\t\t\"target\":\"https://my.website.com/new_customer\",\n\t\t\"request_type\": \"GET\",\n\t\t\"event\": \"customer_new\"\n});", "language": "javascript" } ] } [/block] _See the [Web Hook](doc:hook) documentation for a complete list of writeable properties._