{"__v":0,"_id":"58112e73ded0340f0085d05b","api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"The information presented in the **Cratejoy API** section applies to both the *merchant* and *store* API's\"\n}\n[/block]\n## Cratejoy Store API\nCratejoy offers a Store API, which allows JavaScript to read (and sometimes write) data on behalf of logged-in customers. Theme developers and Merchants looking to customize their subscription workflow or customer account pages should see the [Store API Introduction](doc:introduction) \n\n## Cratejoy Merchant API\nThe [Cratejoy Merchant API](doc:introduction-1) provides an interface into most of the data and functionality of interest to merchants and developers.  It  is useful to merchants and developers looking to write custom scripts or back-end extensions. \n\nThere are some example scripts provided for reference purposes at <a href=\"https://github.com/cratejoy/api_examples\">https://github.com/cratejoy/api_examples</a>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Resources\"\n}\n[/block]\nResource representations are JSON throughout the API, by default. Agents should still send an ```Accept``` header with ```application/json``` for requests, and a ```Content-Type``` header with ```application/json``` for ```POST``` and ```PUT``` requests with a JSON body. In the future, the API may add support for other representations of data.\n\nAll data is encoded with UTF-8, and agents should send data encoded in UTF-8 to avoid problems. Queries and filters are URL parameters. All ```POST``` and ```PUT``` requests use a JSON body. No endpoints use Forms or URL parameters for updates.\n\n### URI Patterns\n* Major versions will be prefixed to all routes: ```/v1/{objects}/```\n* **Collection** Resource URIs follow the pattern ```/{objects}/``` (plural).\n* **Element** Resource URIs follow the pattern ```/{objects}/{id}```.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response Codes\"\n}\n[/block]\n## 2xx Successful Requests\n* ```200 OK``` Will be returned for successful GET, PUT, and PATCH requests.\n* ```201 Created``` Will be returned for successful POST requests.\n* ```204 No Content``` Will be returned for successful DELETE requests\n\n## 4xx Client Errors\n* ```400 Bad Request``` for generic client errors.\n* ```403 Forbidden``` when requesting a Resource which is not accessible by the client.\n* ```404 Not Found``` when requesting a Resource which does not exist.\n* ```405 Method Not Allowed``` when using an inappropriate HTTP method for a Resource.\n* ```429 Too Many Requests``` when a client has issued too many requests.\n\n## 5xx Server Errors\n* ```500 Internal Server Error``` if we are having unspecified problems.\n* ```503 Service Unavailable``` during expected downtime\n\n## Headers\n* ```Retry-After``` In the event of a ```429 Too Many Requests```, a ```Retry-After``` header will be included in the response. Agents can observe this value to retry at a later time. Time is returned in seconds until retry.","category":"58112e72ded0340f0085d02e","createdAt":"2015-09-18T21:10:15.930Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"pages":[],"description":""},"order":0,"parentDoc":null,"project":"551e85be610f400d00837db7","slug":"introduction2","sync_unique":"","title":"Introduction","type":"basic","updates":[],"user":"55f2fd49b5b25021002b7dfd","version":"58112e71ded0340f0085d02a","childrenPages":[]}
[block:callout] { "type": "warning", "body": "The information presented in the **Cratejoy API** section applies to both the *merchant* and *store* API's" } [/block] ## Cratejoy Store API Cratejoy offers a Store API, which allows JavaScript to read (and sometimes write) data on behalf of logged-in customers. Theme developers and Merchants looking to customize their subscription workflow or customer account pages should see the [Store API Introduction](doc:introduction) ## Cratejoy Merchant API The [Cratejoy Merchant API](doc:introduction-1) provides an interface into most of the data and functionality of interest to merchants and developers. It is useful to merchants and developers looking to write custom scripts or back-end extensions. There are some example scripts provided for reference purposes at <a href="https://github.com/cratejoy/api_examples">https://github.com/cratejoy/api_examples</a> [block:api-header] { "type": "basic", "title": "Resources" } [/block] Resource representations are JSON throughout the API, by default. Agents should still send an ```Accept``` header with ```application/json``` for requests, and a ```Content-Type``` header with ```application/json``` for ```POST``` and ```PUT``` requests with a JSON body. In the future, the API may add support for other representations of data. All data is encoded with UTF-8, and agents should send data encoded in UTF-8 to avoid problems. Queries and filters are URL parameters. All ```POST``` and ```PUT``` requests use a JSON body. No endpoints use Forms or URL parameters for updates. ### URI Patterns * Major versions will be prefixed to all routes: ```/v1/{objects}/``` * **Collection** Resource URIs follow the pattern ```/{objects}/``` (plural). * **Element** Resource URIs follow the pattern ```/{objects}/{id}```. [block:api-header] { "type": "basic", "title": "Response Codes" } [/block] ## 2xx Successful Requests * ```200 OK``` Will be returned for successful GET, PUT, and PATCH requests. * ```201 Created``` Will be returned for successful POST requests. * ```204 No Content``` Will be returned for successful DELETE requests ## 4xx Client Errors * ```400 Bad Request``` for generic client errors. * ```403 Forbidden``` when requesting a Resource which is not accessible by the client. * ```404 Not Found``` when requesting a Resource which does not exist. * ```405 Method Not Allowed``` when using an inappropriate HTTP method for a Resource. * ```429 Too Many Requests``` when a client has issued too many requests. ## 5xx Server Errors * ```500 Internal Server Error``` if we are having unspecified problems. * ```503 Service Unavailable``` during expected downtime ## Headers * ```Retry-After``` In the event of a ```429 Too Many Requests```, a ```Retry-After``` header will be included in the response. Agents can observe this value to retry at a later time. Time is returned in seconds until retry.