Errors
In this guide, we will talk about what happens when something goes wrong while using the Wunderite API. Let's look at some status codes and error types you might encounter.
You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support).
Please be aware that 4xx level errors are usually caused by the client (you) and can be resolved by fixing the request. If you are still having trouble, please reach out to support.
Status codes
Here is a list of the different categories of status codes returned by the Wunderite API. Use these to understand if a request was successful.
- Name
2xx
- Description
A 2xx status code indicates a successful response.
- Name
4xx
- Description
A 4xx status code indicates a client error. e.g. a bad request, invalid data, or unauthorized access. See examples.
- Name
5xx
- Description
A 5xx status code indicates a server error. e.g. an unhandled exception or a timeout. Reach out to support if you see one of these. See example.
Error types
Whenever a request is unsuccessful, the Wunderite API will return an error response with a message and other context as applicable. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
Examples
400 - Bad Request response
{
"message": "You do not have permission to access this endpoint: this action is managed by the integration with your AMS.",
"status": 400
}
401 - Unauthorized response
{
"message": "",
"status": 401
}
403 - Forbidden response
{
"message": "This action is unauthorized.",
"status": 403
}
404 - Not Found response
{
"message": "The requested resource could not be found on the server.",
"status": 404
}
422 - Validation error response
{
"message": {
"data.0.data.number": ["The data.0.data.number field is required."]
},
"status": 422,
"validation": true
}
Learn more about validation errors and how to handle them.
500 - Internal Server Error response
{
"message": "Whoops, looks like something went wrong.",
"status": 500
}