Errors can occur during API interactions, and it's important to handle them properly to ensure a smooth and reliable integration. The Verify API returns errors using standard HTTP response codes, along with detailed JSON messages to help you troubleshoot effectively.
Understanding HTTP Error Responses
The Verify API uses standard HTTP status codes to indicate the result of each request:
- 4xx – Client Errors
These indicate that the request was invalid or cannot be processed (e.g., missing parameters or incorrect formatting). - 5xx – Server Errors
These indicate that something went wrong on the server side, even though the request may have been valid.
Sample Error Response
When an error occurs, the API returns a JSON response like the following:
{
"httpStatus": "BAD_REQUEST",
"code": 400,
"timeStamp": "2022-03-01T07:05:32.204+00:00",
"codeName": "BAD_REQUEST",
"exceptionName": "InvalidParameterException",
"message": "jobId format1 is not valid"
}
Key fields explained:
- httpStatus: The status description (e.g.,
BAD_REQUEST). - code: The numeric HTTP code (e.g.,
400). - timeStamp: When the error occurred.
- codeName: Another representation of the HTTP status.
- exceptionName: A more detailed label for the specific error type.
- message: A clear explanation of the error.
Error Handling Steps
- Capture the HTTP Response
Always capture and check the API response—especially when the status code falls in the4xxor5xxrange. - Log the Error Details
Record key information such astimeStamp,exceptionName, andmessagefor auditing or debugging. - Take Action
Use the error type and message to determine next steps. For example:- For
InvalidParameterException, review your input parameters. - For authentication errors, verify your API key or credentials.
- For server errors, retry the request or escalate if the issue persists.
- For
Proper error handling ensures your application can recover gracefully and provide helpful feedback when something goes wrong. Let us know if you need help interpreting a specific error!
Comments
0 comments
Article is closed for comments.