Calls to the API must be for genuine use and responses from the API must not be stored for the purpose of creating an offline copy of the information stored. Failure to comply with this requirement will infringe the API License.
API Errors
Errors Array
If there is a problem processing a call to the API then a response will contain a JSON "errors" array. This array will contain a single error object or several error objects. In most cases you will probably only receive one error but you should be ready to handle any and all errors returned by the API.
By the way we'll also set a server response code of 400, so when you get that server error don't think it's all gone to pot and stop processing otherwise you'll not get the real error message.
Error objects consist of:-
- id - The error number which relates to the cause of the error.
- message - A human readable description of the error.
Example Error
HTTP/1.1 400 Human readable error message
Content-Type: application/json
{
"errors":
[
{
"id": n,
"message": "Human readable message"
}
]
}
Handling Errors
In most cases an error will require the attention of a developer. When errors occur they should be logged, rather than handled. They normally indicate that your program is doing something incorrectly which cannot be solved by the program itself. It is for this reason that we do not have a list of possible errors available. Most of these errors will only occur during development - it is unlikely that complete and tested code will trigger an error response from the API.
Handlable Errors
Code | Message | Action |
---|---|---|
1 | The GAPI is currently unavailable. | If the error persists contact Recipero. |
306 | Insufficient Credits | Contact Recipero to arrange for credits to be added to your account. |