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 error type and error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support).
Status codes
The ola.cv API uses conventional HTTP response statuses and codes to indicate the failure of API calls.
- Name
2xx- Description
A 2xx status code indicates a successful response.
- Name
4xx- Description
A 4xx status code indicates a client error — this means it's a you problem.
- Name
5xx- Description
A 5xx status code indicates a server error — you won't be seeing these.
Error types
Whenever a request is unsuccessful, the ola.cv 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 are some of the common errors you may encounter while working with the API.
- Name
401- Type
- Unauthenticated
- Description
The request was not authorized. This can be triggered by passing an invalid API token in the authorization header or the lack of one altogether.
- Name
403- Type
- Forbidden
- Description
The request was not allowed. You may receive a 403 error if you passed an API token with inappropriate permission or privilege.
- Name
404- Type
- Not Found
- Description
Request could not be fulfilled as the request resource does not exist. Check to make sure you have not deleted the specified resource.
- Name
405- Type
- Method Not Allowed
- Description
The request was not allowed. You may have requested a resource with the wrong HTTP method, e.g a
GETwhen aPOSTis required.
- Name
422- Type
- Unprocessable Entity
- Description
A validation or client side error occurred and the request was not fulfilled.
- Name
429- Type
- Too Many Attempts
- Description
You have made too many requests in a time frame, and have exceeded the rate limit. Slow down the number of requests, and wait for no less than 60 seconds before the next request.
- Name
500- Type
- Server Error
- Description
Request could not be fulfilled due to an error on ola.cv's end. This should not happen, and definitely not so often, so please report as soon as you encounter any instance of this.
Error response
{
"message": "The payment method is not valid.",
"errors": {
"payment_method": [
"The payment method is not valid."
]
}
}