Errors
We expose API errors in two ways, standard HTTP response codes and human-readable messages in JSON format.
This includes hard-errors like 404 and 500s, but also soft-errors such as validation errors, which give a breakdown of the individual attributes and why the data was invalid.
Hard Errors (404s / 500s)
Example 404 response
{
"error":"not_found",
"error_description": "We couldn't find the page you were looking for."
}
Soft Validation Errors
Example validation response
{
"error": "invalid_resource",
"error_description": "The current resource was deemed invalid.",
"messages": {
"name": ["can't be blank"],
"support_telephone": ["can't be blank", "is not a number"],
"support_email": ["is too short (minimum is 5 characters)", "is invalid"]
}
}
Responses
All responses from the Sorry™ API are JSON formatted.
All requests using GET, POST or PUT to our API will return a JSON formatted body containing the result. We wrap this data in an envelope of ‘response’ and also contain certain metadata such as record counts or pagination details.
Single Object Response
Example response
{
"response": {
"id": 1,
"name": "My Example Status Page"
}
}
Multi Object Responses
Example response
{
"response": [{
"id": 1,
"name": "My Example Status Page"
}, {
"id": 2,
"name": "Another Status Page"
}],
"count": 2
}