While interacting with our API, your client application will receive HTTP status codes in the response. These codes belong to different classes: 200's, 400's, and 500's. Your application should handle each of these classes differently.
2XX (Success status codes)
These status codes indicate that your API request was successfully received, understood, and accepted. Here's a brief explanation of the most common 2XX status codes:
- 200 OK: The request has succeeded. The information returned with the response depends on the method used in the request.
- 201 Created: The request has succeeded and a new resource was created as a result. This is typically the response sent after POST requests.
4XX (Client error status codes)
These status codes indicate that there was a problem with the request sent from your side. This could be due to missing parameters, invalid parameter values, or other client-related issues. Here's a brief explanation of common 4XX status codes:
- 400 Bad Request: The server could not understand the request due to invalid syntax.
- 401 Unauthorized: The request lacks valid authentication credentials for the target resource.
- 403 Forbidden: The server understood the request, but it refuses to authorize it.
- 404 Not Found: The server couldn't find the requested resource.
If you receive a 4XX status code, your client application should NOT retry the request without modifications. Check the error message in the response body for specific details about what went wrong.
5XX (Server error status codes)
These status codes indicate that the server encountered an issue and was unable to fulfill the request. This could occur when the server is unreachable, experiencing an overload, or misconfigured. Here's a brief explanation of common 5XX status codes:
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
- 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
- 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance of the server.
If you receive a 5XX status code, your client application should retry the request after a delay, as these errors are typically temporary and may succeed upon retrying.
Remember to design your API client to handle these status codes accordingly for robust and resilient interaction with our API.