Errors
The Language Weaver Edge API uses standard HTTP response codes to indicate whether an API request succeeded or failed. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error caused by invalid parameter(s) provided to the API call, and codes in the 5xx
range indicate an error internal to the API server:
Code | Description |
---|---|
200 | OK -- Everything worked as expected |
400 | Bad Request -- The request was unacceptable due to some invalid or missing parameter |
401 | Unauthorized -- The provided API key or access token was invalid, expired, or missing |
403 | Forbidden -- The authenticated user lacks the required privileges to access the specified endpoint |
404 | Not Found -- The specified endpoint does not exist |
500 | Internal Server Error -- An error occurred within the API server |
Failed API calls usually return an error object with the following fields:
If we try to create a user when the username already exists:
curl "https://controller-host:8001/api/v2/users" \
-X POST \
-u u_jsmith@rws.com_u0VmztKJrwqf: \
-d displayName="John Smith" \
-d username="jsmith@example.com"
This error response is returned:
{
"error": {
"code": 400,
"message": "user could not be added",
"details": "the specified user already exists: jsmith@example.com"
}
}
Field | Type | Description |
---|---|---|
code |
int | HTTP response status code |
message |
string | Human-readable message describing the error |
details (optional) |
string | Additional, more detailed message describing the error |