Skillnad mellan versioner av "Errors:Examples"
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 '== Examples == === Example 1 === ; Request <syntaxhighlight lang="json"> { "query:MinProdukt": { "products": { "filters": { "where": { "id": 183...') |
||
| Rad 1: | Rad 1: | ||
| − | + | == Examples == | |
| − | + | === Example 1 === | |
| + | ; Request | ||
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "query:MinProdukt": { | ||
| + | "products": { | ||
| + | "filters": { | ||
| + | "where": { | ||
| + | "id": 183 | ||
| + | }, | ||
| + | "limit": 10 | ||
| + | }, | ||
| + | "fields": [ | ||
| + | "id", | ||
| + | "name", | ||
| + | "tax_rate", | ||
| + | "invalid_attribute", | ||
| + | { | ||
| + | "invalidRelation": { | ||
| + | "fields": [ | ||
| + | "_all" | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | The | + | ; Response |
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "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" | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | === Example 2 === | |
| + | ; Request | ||
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "invalid_json": {} | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | ; Response | |
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "400", | ||
| + | "code": "VQL_ERROR_MALFORMED_QUERY", | ||
| + | "public": false, | ||
| + | "title": "Malformed request body." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | === Example 3 === | |
| + | ; Request | ||
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "route": "surface/1/voucher/value?voucher=2", | ||
| + | "method": "POST" | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | ; Response | |
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "403", | ||
| + | "code": "VOUCHER_ERROR_8C3D7270" | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | === Example 4 === | |
| + | ; Request | ||
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "route": "surface/1/voucher/value?voucher=2", | ||
| + | "method": "POST" | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | ; Response | |
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "errors": [ | ||
| + | { | ||
| + | "status": "403", | ||
| + | "code": "VOUCHER_ERROR_8C3D7270", | ||
| + | "public": false, | ||
| + | "title": "Disabled through cright." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | === Example 5 === | |
| + | ; Request | ||
| + | <syntaxhighlight lang="json"> | ||
| + | { | ||
| + | "route": "surface/1/bankid/qr-token", | ||
| + | "method": "GET" | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| − | + | ; Response | |
| − | + | <syntaxhighlight lang="json"> | |
| − | + | { | |
| − | + | "errors": [ | |
| − | + | { | |
| − | + | "status": "422", | |
| − | + | "code": "BANKID_NO_ACTIVE_SESSION", | |
| + | "public": true, | ||
| + | "title": "BankID session not started." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </syntaxhighlight> | ||
Versionen från 12 juni 2025 kl. 16.26
Examples
Example 1
- Request
<syntaxhighlight lang="json"> {
"query:MinProdukt": {
"products": {
"filters": {
"where": {
"id": 183
},
"limit": 10
},
"fields": [
"id",
"name",
"tax_rate",
"invalid_attribute",
{
"invalidRelation": {
"fields": [
"_all"
]
}
}
]
}
}
} </syntaxhighlight>
- Response
<syntaxhighlight lang="json"> {
"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"
}
}
]
} </syntaxhighlight>
Example 2
- Request
<syntaxhighlight lang="json"> {
"invalid_json": {}
} </syntaxhighlight>
- Response
<syntaxhighlight lang="json"> {
"errors": [
{
"status": "400",
"code": "VQL_ERROR_MALFORMED_QUERY",
"public": false,
"title": "Malformed request body."
}
]
} </syntaxhighlight>
Example 3
- Request
<syntaxhighlight lang="json"> {
"route": "surface/1/voucher/value?voucher=2", "method": "POST"
} </syntaxhighlight>
- Response
<syntaxhighlight lang="json"> {
"errors": [
{
"status": "403",
"code": "VOUCHER_ERROR_8C3D7270"
}
]
} </syntaxhighlight>
Example 4
- Request
<syntaxhighlight lang="json"> {
"route": "surface/1/voucher/value?voucher=2", "method": "POST"
} </syntaxhighlight>
- Response
<syntaxhighlight lang="json"> {
"errors": [
{
"status": "403",
"code": "VOUCHER_ERROR_8C3D7270",
"public": false,
"title": "Disabled through cright."
}
]
} </syntaxhighlight>
Example 5
- Request
<syntaxhighlight lang="json"> {
"route": "surface/1/bankid/qr-token", "method": "GET"
} </syntaxhighlight>
- Response
<syntaxhighlight lang="json"> {
"errors": [
{
"status": "422",
"code": "BANKID_NO_ACTIVE_SESSION",
"public": true,
"title": "BankID session not started."
}
]
} </syntaxhighlight>