Skillnad mellan versioner av "Errormessages"
Från Vendre Help
m (Skapade sidan med 'Most parents prefer to have their child named in a formal setting and this can be either a religious or a civil ceremony. If the former is the choice then the type of ceremony wi...') |
Johan (Diskussion | bidrag) (Skapade sidan med '== Specification == ; ID (optional) : A unique identifier for this particular occurrence of the problem. Can be used if the error is logged to improve troubleshooting. ; STAT...') |
||
| Rad 1: | Rad 1: | ||
| − | + | == Specification == | |
| − | + | ; ID (optional) | |
| + | : A unique identifier for this particular occurrence of the problem. Can be used if the error is logged to improve troubleshooting. | ||
| − | The | + | ; STATUS (optional) |
| + | : The HTTP status code applicable to this problem. | ||
| − | + | ; CODE (required) | |
| + | : An application-specific error code. The meaning can be internal or public depending on sensitivity. Facilitates troubleshooting. Sensitive information can be hidden behind a code. Localization of error messages can be done through this code. | ||
| − | + | ; PUBLIC (optional) | |
| + | : A boolean indicating if TITLE and DETAIL can be shown to end users. It SHOULD be present if either TITLE or DETAIL is provided. | ||
| − | + | ; TITLE (optional) | |
| + | : A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. | ||
| − | A | + | ; DETAIL (optional) |
| + | : A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized. | ||
| − | + | ; SOURCE (optional) | |
| + | : An object containing references to the primary source of the error. It SHOULD include one of its properties or be omitted. Useful when troubleshooting or showing validation errors. | ||
| − | + | :; POINTER | |
| + | :: A JSON Pointer [RFC6901] to the value in the request document that caused the error. | ||
| − | + | :; PARAMETER | |
| + | :: A string indicating which URI query parameter caused the error. | ||
| − | + | :; HEADER | |
| + | :: A string indicating the name of a single request header which caused the error. | ||
| − | + | == Examples == | |
| + | === VQL - Invalid attribute and invalid relation === | ||
| + | The query can return valid data in addition to one or more errors. | ||
| + | ; Request | ||
| + | <pre> | ||
| + | { | ||
| + | "query:MinProdukt": { | ||
| + | "products": { | ||
| + | "filters": { | ||
| + | "where": { | ||
| + | "id": 183 | ||
| + | }, | ||
| + | "limit": 10 | ||
| + | }, | ||
| + | "fields": [ | ||
| + | "id", | ||
| + | "name", | ||
| + | "tax_rate", | ||
| + | "invalid_attribute", | ||
| + | { | ||
| + | "invalidRelation": { | ||
| + | "fields": [ | ||
| + | "_all" | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| − | + | ; Response | |
| + | <pre> | ||
| + | { | ||
| + | "data": { | ||
| + | "MinProdukt": { | ||
| + | "products": [ | ||
| + | { | ||
| + | "id": 183, | ||
| + | "name": "Clementine Dress", | ||
| + | "tax_rate": 25 | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | }, | ||
| + | "errors": [ | ||
| + | { | ||
| + | "id": "062b392d-fb87-48bf-a898-54615a5946c0", | ||
| + | "status": "422", | ||
| + | "code": "VQL_ERROR_INVALID_ATTRIBUTE", | ||
| + | "public": true, | ||
| + | "title": "Invalid attribute requested.", | ||
| + | "detail": "The requested attribute: invalid_attribute is invalid.", | ||
| + | "source": { | ||
| + | "pointer": "/query:MinProdukt/products/fields/3" | ||
| + | } | ||
| + | }, | ||
| + | { | ||
| + | "id": "5fd5445d-f670-42d5-a966-a3d13d218f4c", | ||
| + | "status": "422", | ||
| + | "code": "VQL_ERROR_INVALID_RELATION", | ||
| + | "public": true, | ||
| + | "title": "Invalid relation requested.", | ||
| + | "detail": "The requested relation: invalid_relation is invalid.", | ||
| + | "source": { | ||
| + | "pointer": "/query:MinProdukt/products/fields/4" | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
| − | + | === VQL - Invalid json === | |
| + | ; Request | ||
| + | <pre> | ||
| + | { | ||
| + | "invalid_json": { | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | ; Response | ||
| + | <pre> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "400", | ||
| + | "code": "VQL_ERROR_MALFORMED_BODY", | ||
| + | "public": false, | ||
| + | "title": "Malformed request body." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Surface - 403 === | ||
| + | ; Request | ||
| + | <pre> | ||
| + | { | ||
| + | "route": "surface/1/voucher/value?voucher=2", | ||
| + | "method": "POST" | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | ; Response | ||
| + | <pre> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "403", | ||
| + | "code": "VOUCHER_ERROR_8C3D7270" | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Surface - 403 with title === | ||
| + | ; Request | ||
| + | <pre> | ||
| + | { | ||
| + | "route": "surface/1/voucher/value?voucher=2", | ||
| + | "method": "POST" | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | ; Response | ||
| + | <pre> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "403", | ||
| + | "code": "VOUCHER_ERROR_8C3D7270", | ||
| + | "public": false, | ||
| + | "title": "Disabled through cright." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Surface - title that can be used === | ||
| + | ; Request | ||
| + | <pre> | ||
| + | { | ||
| + | "route": "surface/1/bankid/qr-token", | ||
| + | "method": "GET" | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | ; Response | ||
| + | <pre> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "422", | ||
| + | "code": "BANKID_NO_ACTIVE_SESSION", | ||
| + | "public": true, | ||
| + | "title": "BankID session not started." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
Nuvarande version från 12 juni 2025 kl. 16.45
Innehåll
Specification
- ID (optional)
- A unique identifier for this particular occurrence of the problem. Can be used if the error is logged to improve troubleshooting.
- STATUS (optional)
- The HTTP status code applicable to this problem.
- CODE (required)
- An application-specific error code. The meaning can be internal or public depending on sensitivity. Facilitates troubleshooting. Sensitive information can be hidden behind a code. Localization of error messages can be done through this code.
- PUBLIC (optional)
- A boolean indicating if TITLE and DETAIL can be shown to end users. It SHOULD be present if either TITLE or DETAIL is provided.
- TITLE (optional)
- A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
- DETAIL (optional)
- A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.
- SOURCE (optional)
- An object containing references to the primary source of the error. It SHOULD include one of its properties or be omitted. Useful when troubleshooting or showing validation errors.
- POINTER
- A JSON Pointer [RFC6901] to the value in the request document that caused the error.
- PARAMETER
- A string indicating which URI query parameter caused the error.
- HEADER
- A string indicating the name of a single request header which caused the error.
Examples
VQL - Invalid attribute and invalid relation
The query can return valid data in addition to one or more errors.
- Request
{
"query:MinProdukt": {
"products": {
"filters": {
"where": {
"id": 183
},
"limit": 10
},
"fields": [
"id",
"name",
"tax_rate",
"invalid_attribute",
{
"invalidRelation": {
"fields": [
"_all"
]
}
}
]
}
}
}
- Response
{
"data": {
"MinProdukt": {
"products": [
{
"id": 183,
"name": "Clementine Dress",
"tax_rate": 25
}
]
}
},
"errors": [
{
"id": "062b392d-fb87-48bf-a898-54615a5946c0",
"status": "422",
"code": "VQL_ERROR_INVALID_ATTRIBUTE",
"public": true,
"title": "Invalid attribute requested.",
"detail": "The requested attribute: invalid_attribute is invalid.",
"source": {
"pointer": "/query:MinProdukt/products/fields/3"
}
},
{
"id": "5fd5445d-f670-42d5-a966-a3d13d218f4c",
"status": "422",
"code": "VQL_ERROR_INVALID_RELATION",
"public": true,
"title": "Invalid relation requested.",
"detail": "The requested relation: invalid_relation is invalid.",
"source": {
"pointer": "/query:MinProdukt/products/fields/4"
}
}
]
}
VQL - Invalid json
- Request
{
"invalid_json": {
}
- Response
{
"errors": [
{
"status": "400",
"code": "VQL_ERROR_MALFORMED_BODY",
"public": false,
"title": "Malformed request body."
}
]
}
Surface - 403
- Request
{
"route": "surface/1/voucher/value?voucher=2",
"method": "POST"
}
- Response
{
"errors": [
{
"status": "403",
"code": "VOUCHER_ERROR_8C3D7270"
}
]
}
Surface - 403 with title
- Request
{
"route": "surface/1/voucher/value?voucher=2",
"method": "POST"
}
- Response
{
"errors": [
{
"status": "403",
"code": "VOUCHER_ERROR_8C3D7270",
"public": false,
"title": "Disabled through cright."
}
]
}
Surface - title that can be used
- Request
{
"route": "surface/1/bankid/qr-token",
"method": "GET"
}
- Response
{
"errors": [
{
"status": "422",
"code": "BANKID_NO_ACTIVE_SESSION",
"public": true,
"title": "BankID session not started."
}
]
}