Response status codes
Successes differ from errors in that their body may not be a simple response object with a code and a message. The headers however are consistent across all calls:
200 OKon success,
POSTreturns 201 on success,
When retrieving stuff for example:
Status: 200 OK
name: 'My first thing'
name: 'My second thing'
Error responses are simply returning standard HTTP error codes along with some additional information:
- The error code is sent back as a status header,
- The body includes an object describing both the code and message (for debugging and/or display purposes),
For a call with an invalid authentication token for example:
Status: 401 Access denied
message: 'Access denied: invalid authentication token.'