Error Handling

General Error Handling

Any “operational” error will return either HTTP status code 200 (for success) or 422 (for failure). Any response with these HTTP status codes should be parsable in the standard response format:

For Success (HTTP 200)

{  
    "messages": [],  
    "success": true,  
    "value": { .. response payload.. }  
}

For Failure (HTTP 422)

{  
    "code": "ERROR_CODE",  
    "messages": [  
"Friendly display message.",  
"Friendly display message 2.",  
	“...”  
    ],  
    "success": false  
}

Other Errors

Any other HTTP status code you receive will indicate a non-operational error and you shouldn't attempt to parse the response as JSON. These HTTP status codes will have the traditional meaning but some of the notable ones:

HTTP Status Code

Meaning

400

Corrupted message format.

This will only occur if the server can’t parse / interpret the request. If the request is parsable (i.e. valid JSON) but a logical validation failure occurs - these failures are returned in the standard format with a 422 response code.

401

Invalid authorization header.

The key supplied in the authorization header is missing or invalid.

403

Insufficient access.

Your API key doesn't has sufficient access to make the request.

404

Invalid route.

This will only occur if the route you are requesting does not exist. In the event the route exists but the target record is missing / not found - that will be returned in the standard format with a 422 response code.

500

Unhandled server error.

This will only occur if an unhandled server error occurs. Any other internal exception that is caught will be returned in the standard format with a 422 response code.