Errors
In this guide, we will talk about what happens when something goes wrong while you work with the API. Mistakes happen, and mostly they will be yours, not ours. 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 type and error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support).
Before reaching out to support with an error, please be aware that 99% of all reported errors are, in fact, user errors. Therefore, please carefully check your code before contacting Verdantly support.
Status codes
Here is a list of the different categories of status codes returned by the Verdantly API. Use these to understand if a request was successful.
- Name
2xx
- Description
A 2xx status code indicates that the request was successfully received, understood, and accepted.
Examples
200 OK
— the request has succeeded.
- Name
4xx
- Description
A 4xx status code indicates a client-side error, meaning the request contains incorrect syntax, is missing required parameters, or cannot be fulfilled by the server.
Examples
400 Bad Request
— the request is malformed or missing required parameters.404 Not Found
— the requested resource could not be located.
- Name
5xx
- Description
A 5xx status code indicates a server error. Please contact us with the appropriate information such as request payload and server response, and we'll get this fixed.
Examples
500 Internal Server Error
— the server encountered an unexpected condition.
Error types
Whenever a request is unsuccessful, the Verdantly API will return an error response with an error type and message. 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.
Here is a list of the two error types supported by the Verdantly API — use these to understand what you have done wrong.
- Name
Server Error
- Description
We made an error. Let us know so we can make it right.
- Name
Bad Request
- Description
This means that you missed something on your side, like a required parameter or an invalid value. Check the error message for more information and reach out if you need help.
Error response
{
"message": "The ID provided is not valid. Please provide a valid vegetable ID."
"error": "Bad Request"
"statusCode": 400
}