Errors¶
Error responses across all APIs are always returned with an HTTP status code ≥ 400, i.e. 400, 401, 403, 404, 429, 500.
The media type is application/problem+json
. Error responses comply to the Problem Details IETF Draft and to HAL.
JSON Schema: https://schema.entrecode.de/schema-acc/error
The following properties are REQUIRED:
status
is the HTTP status code of the error and the same status code as the actual HTTP responsecode
is a four digit error code as defined belowtitle
is the generic, short description of the error codetype
is the URL to the description of the error code_links
is a HAL link object that includesup
anddescribedby
link relations;describedby
is the same URL astype
.
The following properties are OPTIONAL:
detail
is the name of the object the error occurred on (e.g. the invalid property)verbose
any additional information about the error_embedded
is a HAL embed object that MAY includeerror
sub-resources.
Error sub-resources can be used to indicate more errors that occurred or would have occurred, if the enclosing main error would not have occurred.
Error sub-resources have a subset of the properties described above: code
, title
, type
and detail
.
Example¶
{
"status": 400,
"code": 2202,
"title": "Missing property in query string",
"type": "https://entrecode.de/doc/errors/2202",
"detail": "count",
"_links": {
"up": {
"title": "Data Manager Home Page",
"href": "https://datamanager.entrecode.de"
},
"describedby": {
"title": "Error Description",
"href": "https://entrecode.de/doc/errors/2202"
}
}
"_embedded": {
"error": {
"code": 2201,
"title": "Missing property in JSON Body",
"type": "https://entrecode.de/doc/errors/2201",
"detail": "property"
}
}
}
Error Codes¶
Error codes are 4 digit decimal codes. They consist of two parts. The first number identifies the system the error occurred in, the last three numbers identify the error, they are the actual error codes. Examples:
2100: A requested resource in the Datamanager does not exist.
2202: A request to a resource in the Datamanager misses a required property in its query string. The detail field of the error response will indicate which property.
3000: An internal error occurred in the Appserver, probably a server-side bug.
First Number: System¶
Code | System |
---|---|
1xxx | Account Server |
2xxx | Data Manager |
3xxx | App Manager |
More Codes may be added in the future.
Second Number: Error Code¶
The actual error code (code
) is partitioned in error types (bold in the table below).
The detail
field includes further information about the subject of the error.
The verbose
field may be used for further information what is actually wrong with the subject in detail
.
Guidelines for definition of new error codes¶
- a suitable HTTP error code should still be used
- codes should be added to the defined error types (1xx-5xx)
- codes are logically sub-partitioned in groups of ten
- codes above x5x should be used for very (resource- or system-)specific errors