Post analysis tokens

To request a number of tokens that can be generated with an 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. Additionally, to request an built-in stochastic analysis of the tokens that being generated , the HTTP request path attribute analysis MUST be sent as metrics. Furthermore, it is RECOMMENDED to send a meta seed in the JSON request body, which will later be taken into account when hashing the files of the production line.

The data attributes available value in the JSON response body shows the number of tokens that can be generated by the production line in general, just before the production starts. This number can be determined as described in the previous step and may be subject to further, non-technical restrictions. The data attributes size in the JSON request body determines the number of tokens to produce and MUST be less or equal to the number of (in general) available and (here in special) reachable tokens. Any larger requested size is scaled down by the remote service to the reachable size.

The identifier of the new tokens object is returned from the remote service in the JSON response body as data id together with other attribute–value pairs. In particular, data attributes analysis: metrics indicates that an integrated stochastic analysis at metrics level is requested. The remote service immediately starts producing the tokens.

Request endpoint

POST SERVER:PORT/api/tokens?analysis=metrics

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

{
    "meta": {
        "seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    },
    "data": {
        "attributes": {
            "size": 7776,
            "digits": 5,
            "alphabet": "DICE"
        },
        "type": "tokens",
        "relationships": {
            "payment": {
                "data": {
                    "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                    "ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
                    "type": "transaction"
                }
            }
        }
    }
}

Response body

{
    "meta": {
        "seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    },
    "links": {
        "self": "/api/tokens",
        "info": "/api/tokens/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    },
    "data": {
        "attributes": {
            "available": "7776",
            "status": "requested",
            "analysis": "metrics",
            "size": "7776",
            "reachable": "7776",
            "alphabet": "DICE",
            "timestamps": {
                "requested": "2024-03-19T12:57:41.133Z"
            },
            "digits": "5"
        },
        "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "type": "tokens",
        "relationships": {
            "payment": {
                "data": {
                    "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                    "ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
                    "type": "transaction"
                }
            }
        }
    }
}

HTTPie example

$ http post SERVER:PORT/api/tokens?analysis=metrics Accept:application/vnd.api+json Content-Type:application/vnd.api+json Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS << JSON
{
    "meta": {
        "seed": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    },
    "data": {
        "attributes": {
            "size": 7776,
            "digits": 5,
            "alphabet": "DICE"
        },
        "type": "tokens",
        "relationships": {
            "payment": {
                "data": {
                    "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                    "ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
                    "type": "transaction"
                }
            }
        }
    }
}
JSON