api:errors
Table of Contents
Error responses
When an error occurs during an API call, a standardized JSON error message is returned.
The HTTP response code will also reflect the type of error that occurred.
HTTP response codes used
| Status code | Message | Description |
|---|---|---|
| 400 | Bad request | When the requested URL could not be parsed correctly. |
| 401 | Unauthorized | When the user did not present a valid token, and needs to login. |
| 403 | Forbidden | When the user tries to perform an action that the user does not have permission for. |
| 404 | Not found | When a required item or property is not found or missing. |
| 409 | Conflict | When a property is in conflict with another item. |
| 422 | Unprocessable Entity | When a property contains invalid data. |
| 500 | Internal Server Error | When the server had an unexpected error. |
The format of the error response
Error responses carries a body with a JSON document describing one or more errors.
Each error contains the following properties.
| Property | Type | Description |
|---|---|---|
| code | String | Path of the property that has errored or a default error message. |
| path | String | Path of the property that has errored - if available. |
| status | Number | The status code: 400, 401, 403, 404, 409, 422, 500 |
| message | String | A human readable message describing the error. |
| check | String | Type of validation check that failed - if available. |
General error messages
The possible error response are described on each API calls documentation page at the bottom of the page.
These generel errors may occur on all API calls, but are described on each API call.
| Status | Code | Message |
|---|---|---|
| 401 | expired | Session has expired, please login |
| 401 | credentials_invalid | Authorization required, please login |
| 401 | format_error | Authorization header format is Authorization: Bearer <token> |
| 401 | invalid_token | Undecipherable |
| 401 | invalid_token | IP address not authenticated |
| 401 | invalid_token | Please login |
Example error message
Single error
{ error: { message: "MVNO account not found", code: "mvnoAccount", status: 404 } }
Multiple errors
{ "error": { "code": "multiple", "status": 422, "inner": [ { "message": "User not found", "code": "userId", "status": 404 }, { "message": "Invalid street", "code": "address.street", "status": 422 }, { " message": "Zip is missing", "code": "address.zip", "status": 404 } ] } }
api/errors.txt · Last modified: 2019/03/28 10:31 by Per Møller