A request can either fail because of a variety of reasons and the app must be able to handle errors for any request.
The error object has two fields: code and message which are used to determine the cause of the error. The code field is the same as the HTTP status code of the request. The error object might also have some other fields depending on the error type.
The auth token is not valid. The auth token must be provided for every request except account.login. When this error is encountered, the token must be dropped and the login form should be shown to the user.
The HTTP method used or the path of the request does not conform to the ones shown in the documentation.
The request data is not valid JSON data.
The request type (the type field in the request data) does not exist or is not implemented.
A request parameter is required but was not provided (e.g. account.login without password field)
-
Field
missingParameters: An array of missing parameter names.Examples:
passwordroom.id
A request parameter is provided but is of the wrong type or value.
- Field
paramName: The name of the parameter which was passed incorrectly
One of these cases:
- A number is too big or too small
- A string is too short or too long
- An array has too few or too many elements
- Field
paramName: The name of the problematic parameter
An internal server error occurred. This is most likely a bug and should be reported.
More than 10 requests in the last second were made. Wait for 1 second and resend the request.
The requested resource was not found. Depends on the request.
- Field
object: The object that was not found. Value depends on the request and can be found in the documentation of the request that return this error.
Some request can return errors not listed above. They are documented in the description of the request.