Errors
In this guide, we will talk about what happens when something goes wrong while you work with the 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 status code error and error message to figure out what has gone wrong.
Status codes
Here is a list of status codes returned by the WonderDays API. Use these to understand if a request was successful.
- Name
200
- Description
A 200 status code indicates a successful response without any errors.
- Name
400
- Description
A 400 status code indicates a client error. For example if passing a voucher number that does not exist. This is not a fatal error and means, that at least one error exists. Check the voucher documentation for more info.
- Name
403
- Description
A 403 status code indicates that the authentication failed. Check your Bearer token.
- Name
5xx
- Description
A 5xx status code indicates a server error on our end. Please try again later or contact us at [email protected] if the issue persists.
Soft Errors
If an error occurrs, but the request has been successful. This is the case with a 400 error.
See a example response below which indicates, that some data has been returned, but errors occurred as well.
Error response
{
"data": [
{
"customer_first_name": "Peter",
"voucher_number": "WD1111TEST",
// ...
},
{
// ...
}
],
"errors": {
"WD1111NOTFOUND": {
"message": "Voucher does not exist"
}
{ ... }
}
}
Fatal Error
A fatal error with a 500 status code means that the request could not be handled.
Check for a 500 status code and the error message.
Error response
{
"error": { "message": "authentication failed ..." }
}