Errors¶
Error handling and replies are defined in the JSON:API specification.
If an error occurs, the API tries to return a meaningful error description, like:
GET /books/?page[number]=1&page[size]=2
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
https://api.socialwifi.com/examples/books/?sort=oops \
| jq
Example error response
{
"errors": [
{
"status": 400,
"source": {
"parameter": "sort"
},
"title": "Invalid sort querystring parameter.",
"detail": "Book has no attribute oops"
}
],
"jsonapi": {
"version": "1.0"
}
}
Additionally, if no API token or an invalid token is used, a 400
Bad Request reply is returned.