Errors
If something goes wrong, the API would return an API Response wrapping one or more errors (in the case of a form validation error), an API Error is of the following form:
{
"meta": {
"status": 401,
"error": {
"status": 401,
"type": "Unauthorized",
"message": "You are not authorized to perform this action."
}
}
}
The error's type
is an identifier that is explained further below.
Error Types
Unauthorized
Returned when making a request that requires authentication. An invalid or lack of an Authentication Token is most likely the cause for this error.
Forbidden
Returned when the request has been denied because the subject
(entity making the request, usually a user or client application) does not have the rights to perform the action.
AlreadyExists
Returned when creating or updating an entry with an identifier that must be unique, for example a user's email address.
NotFound
Returned when the requested resource is non-existent.
BadRequest
Could be returned for a variety of reasons, for example when making a POST request and the JSON in the body is malformed.
UnprocessableEntity
Similar to ValidationFailure
, it usually means that the structure of the resource being sent is incorrect. For example when creating a Project but there are fields missing.
UnsupportedMediaType
Returned when making a request with an unsupported Content-Type
. For example if posting a JSON body with the Content-Type
incorrectly set to text/xml
.
InternalError
Returned when something went wrong internally and very likely not being the user's fault. This kind of error is the most difficult to trace as it could mean anything. Take a look at the API server logs for any stack traces or recovery error messages for more information.
ValidationFailure
Usually returned when validation failed on a POST
, PUT
or PATCH
request. This error type is special as it can contain multiple other errors, for example:
{
"meta": {
"status": 422,
"error": {
"type": "ValidationFailure",
"message": "data validation failed",
"errors": [
{
"type": "InvalidEmail",
"message": "invalid email"
},
{
"type": "InvalidPassword",
"message": "invalid password"
}
]
}
}
}