mirror of
https://github.com/adidas/api-guidelines.git
synced 2025-10-25 15:19:19 +00:00
Add clarification on problem detail fields
This commit is contained in:
@@ -4,7 +4,7 @@ The [`application/problem+json`](https://tools.ietf.org/html/rfc7807) \(Problem
|
||||
|
||||
Problem Detail is intended for use with the HTTP status codes 4xx and 5xx. Problem Detail **MUST NOT** be used with 2xx status code responses.
|
||||
|
||||
At the minimum, any Problem Detail response **MUST** have the `title` and `detail` fields.
|
||||
At the minimum, any Problem Detail response **MUST** have the `title` and `detail` fields. `title` value **SHOULD NOT** change from occurrence to occurence of the problem, except for purposes of localization (e.g., using proactive content negotiation) [read more](https://tools.ietf.org/html/rfc7807#section-3.1)
|
||||
|
||||
### Example
|
||||
|
||||
@@ -15,6 +15,8 @@ At the minimum, any Problem Detail response **MUST** have the `title` and `detai
|
||||
}
|
||||
```
|
||||
|
||||
> NOTE: `title` and `detail` fields **SHOULD NOT** be parsed to determine the nature of the error. Instead `type` **MUST** be used.
|
||||
|
||||
## Optional Fields
|
||||
|
||||
It **SHOULD** has the `type` field with the identifier of the error, besides it **MAY** have the `instance` field with the URI of the resource in question. If the Problem Detail response has the `status` field it **MUST** have the same value as HTTP Status code from of the response.
|
||||
@@ -39,7 +41,7 @@ If needed, the Problem Detail **MAY** include additional fields, refer to [RFC78
|
||||
|
||||
When necessary, a Problem Detail response **MAY** include additional error details about the problems that have occurred.
|
||||
|
||||
These additional errors **MUST** be under the `errors` and **MUST** follow the Problem Detail structure.
|
||||
These additional errors **MUST** be under the `errors` collection and **MUST** follow the Problem Detail structure.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -127,4 +129,3 @@ An API description **SHOULD** list all the error codes with which the API respon
|
||||
## External resources
|
||||
|
||||
There are a whole plethora of libraries working with Problem Detail, for example, see [Zalando / Problem](https://github.com/zalando/problem) \(Java\).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user