Post more than maximal tokens
To request a number of tokens that can be generated with a preset alphabet for a number of digits, all of these values MUST be sent as data attributes together with the data type: tokens in the JSON request body. The data relationships payment data value in the JSON request body MUST contain the type: transaction, a valid transaction id according to the schema XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX and a valid payment intent ident according to the schema pi_XXXXXXXXXXXXXXXXXXXXXXXX. Here the API remote service is attacked by trying to get a number of tokens more than the algorithm-related maximum in the HTTP request body.
The errors status: 406 is returned from the remote service together with the errors detail: Out of range. in the JSON response body.
The basic agreement-related limits restrict each part of each production line to (included) 1,000 ... 100,000 tokens and 3 ... 100 digits. These values can also be restricted by algorithm-related limits. The smallest of the three restrictions applies.
Request endpoint
DELETE SERVER:PORT/api/tokens
Response status
201
Request headers
Accept:application/vnd.api+json
Content-Type:application/vnd.api+json
Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS
Response headers
Transfer-Encoding:chunked
Connection:keep-alive
Accept:application/vnd.api+json
Cache-Control:no-cache
Date:Tue, 19 Mar 2024 12:57:41 GMT
Content-Type:application/vnd.api+json
Server:nginx/1.25.4
Request body
{
"data": {
"attributes": {
"size": 3656158440062977,
"digits": 20,
"alphabet": "DICE"
},
"type": "tokens",
"relationships": {
"payment": {
"data": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
"type": "transaction"
}
}
}
}
}
Response body
{
"errors": [
{
"status": 406,
"detail": "Out of range.",
"source": {
"parameter": "size",
"pointer": "/data/attributes/size"
},
"title": "Tokens not requested"
}
],
"links": {
"self": "/api/tokens"
}
}
HTTPie example
$ http delete SERVER:PORT/api/tokens Accept:application/vnd.api+json Content-Type:application/vnd.api+json Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS << JSON
{
"data": {
"attributes": {
"size": 3656158440062977,
"digits": 20,
"alphabet": "DICE"
},
"type": "tokens",
"relationships": {
"payment": {
"data": {
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
"type": "transaction"
}
}
}
}
}
JSON