API response
When the API returns its response and it went well, you will find several recurring elements:
successhas its value astruestatusCodehas its value as200codehas its value asokdatacontains the informations of the response
Example of a successful response from the API:
{
"success": true,
"statusCode": 200,
"code": "ok",
"data": {
[...]
}
}
IMPORTANT
Some endpoints can send back the HTTP status 200, because the request has been going through, but without finding any relevant data.
It is recommended to test that the HTTP status is equal to 200 AND that code (in the response) contains ok.
Response of the country data endpoint when the country code doesn't match any country:
{
"success": true,
"statusCode": 200,
"code": "no_country_found",
"message": "No country found"
}
Errors
If your request to the API fails, it will return a response containing a statusCode, a code and a message giving you the type of the error (and the value of success, which will be false).
Example response when an error is encountered by the API:
{
"success": false,
"statusCode": 429,
"code": "quota_exceeded",
"message": "Quota exceeded for this API key"
}
Codes and error messages
Endpoints have their own error messages, but there are other global codes and messages:
| StatusCode | Code | Description |
|---|---|---|
429 | quota_exceeded | « Quota exceeded for this API key » Displays when the mensual quota has been exceeded. |
404 | not_found | « The requested resource does not exist » The endpoint doesn't exist. |
403 | invalid_api_key | « API key is invalid or missing to access to the requested resource » The API key sent with the request is invalid or missing. Learn more about authentication |
500 | internal_error | « An internal error occurred » An error has occurred on the API side. Please contact us if the problem persists. |