Error Response and Handling
Error Response and Handling
Whenever any APIs give a non-successful status code (non-2xx), we can consider these cases failures. The status code responses will have the meaning as per HTTP standards. There will be error codes and error messages that will give more insights of what is the major reason for failure. This error response is common and applicable to all APIs.
Status Codes
The Success status code is given in the sample response section of each api
Status Code | Meaning |
---|---|
400 | Bad request - the request made may contain some unexpected or incorrect information |
401 | Unauthorized - Exception during decryption or wrong API-Key in headers |
403 | Forbidden - mainly comes if the IP is not whitelisted |
404 | Not Found - given endpoint not available or item in the request not found |
429 | Too many requests within a given time |
5xx | Internal server errors - due to some exceptions while performing relevant operations |
Sample Error Response
{
"errorCode": 700,
"errorMessage": "error while decryption"
}
Error Codes
Each of the error codes will have its own meaning. This will help us to give more insights into why errors occurred.
In general,
7xx - signifies errors related to encryption/decryption and authorization.
8xx - signifies errors related to incorrect request
9xx - signifies errors occurred in the recharge service
Error Code | Reason |
---|---|
700 | Error while decryption |
701 | Error while encryption of response |
702 | Invalid API key in the header |
802 | Invalid JSON provided |
803 | Constraint violation - either required field empty, not found or incorrect |
804 | Given operator/circle code is invalid |
805 | Duplicate referenceId |
806 | No matching records for given referenceId |
807 | Order not created for given referenceId |
900 | Error while connecting with the recharge server |
901 | Exception in the recharge server |
Empty | An unknown error occurred |