Receiving error codes
The following is an an example of a common error response, resulting from a failed API Call. Errors contains a status code and a message.
curl --location --request GET 'https://api.viously.com/v2/users/me?fields=product' \
--header 'Authorization: Bearer <token>'
{
"error": {
"code": 400,
"message": "product isn't a valid field."
}
}
HTTP Status Code
The Viously API uses standard HTTP response codes to indicate success or failure of an API request.
In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error resulting from invalid provided information (e.g. a required parameter is missing, invalid access token, etc.), and codes in the 5xx range indicate an error with the Viously servers. We are using the following match for error codes:
HTTP errors | Corresponding Viously error |
---|---|
400 Bad Request | The API call was invalid (e.g: using an invalid parameter). |
401 Unauthorized | On /authentication , your authentication attempt failed.Elsewhere, a valid access token should be provided. This error may come from a missing or expired access token. |
403 Forbidden | The request is understood, but it has been refused or access is not allowed. This code is used when the request requires higher privileges than provided by the access token. |
404 Not Found | The requested object was not found (can also be thrown when you request deleted datas, non active users, etc.). |
405 Method Not Allowed | Invalid HTTP Method. E.g : you call /authentication in GET instead of POST |
500 Internal Server Error | This API error covers any other type of problem (e.g: a temporary problem with the Viously servers) and should turn up only very infrequently. |
Please note that all error responses are accompanied by a message explaining why.