Chargetrip Tile Service with React Native and Mapbox
An introduction to the Chargetrip Tile Service and the caveats of integrating it into a React Native mobile application.
Read moreTo ensure you can respond appropriately when our API gives unexpected output, we maintain a consistent set of API response and error codes. The general design of these will be discussed inside this chapter.
Our API uses the following response status codes, as defined in the RFC 2616 and RFC 6568;
Status | Description | ||
---|---|---|---|
200 | The request succeeded. The client can read the body. | ||
201 | The request is created. A new resource will be created. | ||
202 | The request is accepted. The client has to wait until it’s done processing. | ||
204 | The request has succeeded but returns no message body. | ||
304 | Not Modified. | ||
400 | The request could not be understood by the server due to malformed syntax. | ||
401 | The request requires authentication. | ||
403 | The server understood the request, but is refusing to fulfill it. | ||
404 | The requested resource could not be found. | ||
429 | Too Many Requests. | ||
500 | Internal Server Error. If you catch one, report your issue here. | ||
502 | Bad Gateway. | ||
503 | Service Unavailable. |
Apart from the response codes, unsuccessful responses return their generic GraphQL error described here alongside some additional fields. The additional fields can be found inside the extensions object. The most important one here is the exception object. This contains all the information about the error and looks as follows;
Your project id with the corresponding configuration
The status code of the response reflecting the API response codes
The message describing the error
A unique error code that can be used for localization
If we want to reflect this as a curl it would look like this;
{
"errors": [
{
"message": "The car was not found in the database",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addReview"
],
"extensions": {
"exception": {
"response": "CAR_NOT_FOUND",
"status": 500,
"message": "No car was found with the provided ID",
"code": "CAR_NOT_FOUND"
}
}
}
],
"data": null
}
Navigate to our API reference to get a more detailed look at the possible errors per request.