Fail Response-type

A Fail response is returned whenever the API could not process a request due to incorrect input. Examples are usage of invalid parameters, incorrect authentication or simply a resource that could not be found. On the transport level, Fail responses are combined with a HTTP status code from the Client Error range (400-499).

Required keys

  • status: Will always be set to “fail”.
  • data: Wrapper for any data returned by the API call. If the call returns no data, it will be set to null.

An example Fail response is:

{
    "status": "fail",
    "data": "The requested resource could not be found."
}

In the example above, indicates an issue with a specific input-field.

The fail-reason may be spanning multiple input fields, or even may be related to the whole request. In those cases, no key(s) to the error messages can be provided. The error message will be the only part of the data object, like in the example below:

{
  "status": "fail",
  "data": "Authorization has been denied for this request."
}