Error codes and messages

Nitrobox uses conventional HTTP response codes to indicate the success or failure of an API request. In general:

  • Codes in the 2xx range indicate success.
  • Codes in the 4xx range indicate an error that occurred, because the client did not provide a valid request (e.g., a required parameter was omitted, the requested change is not possible, etc.). The client should correct the original request and try again.
  • Codes in the 5xx range indicate an internal error with Nitrobox's servers.

Error responses always provide error details in the body of the response in JSON format.
The response contains the following fields:

{
  "status": "<http status in text form matching to the http returned provided>",
  "timestamp": "<date and time (UTC) when the error occurred>",
  "message": "<descriptive error message>",
  "path": "<request path that was accessed>",
  "uuid": "<a UUID that correlates with an error message logged on the server>"
  "errors": [
    { "error": "<an array with JSON objects, that further describe errors>"},
  ],
}

An example error message for a failed validation could look like this:

{
  "status": "BAD_REQUEST",
  "message": "Validation of a request body reported input errors",
  "timestamp": "2021-01-01T08:00:00.000000",
  "path": "/api/debtors/",
  "uuid": "7fb76a6b-e6a1-4ff6-bf1f-69cf91591b98",
  "errors": [
    {
      "fieldName": "addresses[0].addressType",
      "error": "must not be null",
      "rejectedValue": null
    }
  ]
}