Status and Error Codes
Sometimes things do not go as planned. To manage these situations effectively, Chargetrip uses default GraphQL errors with error extensions. Error codes help developers identify specific issues, provide meaningful feedback to users, and make debugging and troubleshooting easier. Additionally, these error codes can be used to create translatable errors for internationalization and localization.
API Response Codes
Our API uses the following response status codes, as defined in the RFC 2616 and RFC 6568.
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. |
API Error Objects
When an error occurs, the Chargetrip API returns a generic GraphQL error with an extension. An error description can be found inside the extension object.
Authorization / Headers
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
{
"errors": [
{
"message": "The vehicle was not found in the database",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addReview"
],
"extensions": {
"exception": {
"response": "VEHICLE_NOT_FOUND",
"status": 500,
"message": "No vehicle was found with the provided ID",
"code": "VEHICLE_NOT_FOUND"
}
}
}
],
"data": null
}