Error Responses
All web service API's can response with JSON objects, however some legacy API's return XML/HTML error responses by default.
Api's will return JSON errors if a request contains the "Accept" header with a valid json content type, "application/json" or "text/json"
We strongly recommend the use of the "Accept: application/json" on all web service requests to ensure that all error responses are returned in a consistent format.
JSON Error Response
The JSON response object always contains the two parameters, error and request. These objects are further detailed below.
error
Parameter | Value | Availability | Description |
code |
string |
always |
Either an Error Code, or an HTTP status code
|
text |
string |
always |
A text description of the error |
details |
string |
optional |
When multiple validation errors occur this contains a list of individual error descriptions. Only present if there are multiple errors |
datetime |
string |
always |
The timestamp for when the error occurred |
link |
string |
always |
A link to either the API documentation or documentation for a specific error code
|
request
Parameter | Value | Availability | Description |
url |
string |
always |
The url that was called |
datetime |
string |
always |
The timestamp for when the request was received |
Examples:
Single error
{
"error": {
"code": HTTP 400,
"text": "Bad Request: user_id 'Bob' is already present",
"datetime": "2021-01-15_08:56:24",
"link": "https://www.aculab.com/cloud/web-services/voice-biometrics/users?target=service_action_tabs&tab-id=register"
},
"request": {
"url": "/voice_biometrics/v1/user/register",
"datetime": "2021-01-15_08:56:23"
}
}
Multiple validation errors
{
"error": {
"code": HTTP 400,
"text": "Failed to validate configuration, see details for the specific failures.",
"details": [
"uas.application_name 16 is not of type 'null' or 'string'.",
"rest.first_page.address 'woiern' is too short.",
"rest.first_page.method 'haha' is not one of ['GET', 'POST'].",
"service_password None is not of type 'string'. For UAS, you must provide an application_name and service_password.",
"uas.application_name 16 is not of type 'string'. For UAS, you must provide an application_name and service_password.",
"fax.send.enabled False was expected. You can only enable fax when extra_channels is set to zero."
],
"datetime": "2021-01-15_08:56:24",
"link": "https://www.aculab.com/cloud/web-services/services/outbound?target=service_action_tabs&tab-id=Create"
},
"request": {
"url": "/service/v1/outbound/new_service_1",
"datetime": "2021-01-15_08:56:23"
}
}