Responses (Success and Error)

Success response

All successful responses will return a json object with a status key of “success” and a data key. This data key will always be an object or null.

Requests that specify the resource such as PUT/POST (or GET when a resource <ID> is specified) will return the resource object inside the data object with a key of item.

Requests that return multiple resources such as a GET request, will return an array of resource objects inside the data object with a key of items.

Examples

{ "status": "success", "data" : null } { "status": "success", "data" : { "item" : {} } } { "status": "success", "data" : { "items" : [] } }

Error response

All errors return a json object with a status key of “error”. The error code and error message keys are also always set in this object. If debugging is turned on in the api, additional data will appear in this object.

Example

{ "status": "error", "code": 404, "message": "Item not found" }

Error codes

We use the following error codes:

Error Code

Meaning

Error Code

Meaning

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

405

Method Not Allowed

500

Internal Server Error

501

Not Implemented

503

Service Unavailable

Suppressing Error Codes

Adding suppress_response_codes to the header or GET string will ensure a HTTP 200 response is always returned. This is for legacy systems where codes other than 200 are not passed back to the handling code.