Error Response Structure
In case of an error, the response may consist of following:
Fields | Present in Error Response [Required/Optional] | Description | Example |
---|---|---|---|
status | Required | Status of the request. | BAD_REQUEST |
message | Required | Human readable message describing the error. | Similar identification type and value found |
code | Optional | Error Code. | 400 BAD_REQUEST |
errors | Optional | Array with error details. | [ "Customer has already been assigned with same email id" ] |
Some examples are as follows:
{
"status": "BAD_REQUEST",
"message": "Unable to read request body or no request body provided",
"errors": [
"JSON parse error: Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value
at [Source: (PushbackInputStream); line: 28, column: 27] \(through reference chain: com.nium.spend.cards.customer.dto.request.CustomerDataRequestDTO[\"correspondenceCity\"])"
]
}
{
"status": "BAD_REQUEST",
"message": "Customer has already been assigned with same email id",
"errors": [
"Customer has already been assigned with same email id"
]
}
Error Codes
In case of successful API call, HTTP Status Code 200 is to be expected.
In case of an error, HTTP Status Code 4xx or 5xx range is to be expected.
Following table contains the most common error codes you may encounter:
Error Code | Meaning |
---|---|
400 Bad Request | The request could not be understood by the server due to malformed syntax |
401 Unauthorized | The request requires user authentication. |
403 Forbidden | The server understood the request, but is refusing to fulfill it. |
405 Method Not Allowed | The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. |
429 Too Many Requests | Request counts exceed our limit. Slow down! |
500 Internal Server Error | We had a problem with our server. Try again later. |
503 Service Unavailable | We're temporarily offline for maintenance. Please try again later. |
Updated 7 months ago