Post 2nd tokens part

To request the tokens for the 2nd temporally separated part for a number of digits of a custom alphabet, all of these values MUST be sent as data attributes together with the data type: tokens in the JSON request body in the same manner as previously shown for the 1st part. 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. Furthermore, the identifier of the tokens object, known as data id from the 1st part, MUST be sent as HTTP request path parameter.

In order to restore the captured production line for the point in time at which production of the 1st part has been finished, the snapshot MUST be uploaded to the remote service too. Both MUST be sent simultaneously as two parts of a HTTP Multipart object, which contains the JSON request body, named as info.json and the blob file, named as snapshot.blob.

Custom alphabet

Each snapshot also captures and restores the custom alphabet that was used on the production line in that particular session. A user-defined alphabet with the same identifier in the current session will be overwritten by the restore without warning.

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. The data attributes size in the JSON request body determines the number of tokens to produce for the 2nd part. This number may be subject by non-technical restrictions. Any larger requested size is scaled down by the remote service to the available or reachable size.

The identifier of the restored tokens object is returned from the remote service in the JSON response body as data id together with other attribute–value pairs. The remote service immediately starts producing the tokens.

Request endpoint

POST SERVER:PORT/api/tokens/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Response status

201

Request headers

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:33 GMT
Content-Type:application/vnd.api+json
Server:nginx/1.25.4

Request body

{
    "meta": {
        "seed": "HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH"
    },
    "data": {
        "attributes": {
            "size": 1000,
            "digits": 100,
            "alphabet": "UPPER_VOWELS"
        },
        "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": "7888609052210118054117285652827862296732064351090230047702789306639625",
            "status": "requested",
            "analysis": "none",
            "size": "1000",
            "reachable": "10485",
            "alphabet": "UPPER_VOWELS",
            "timestamps": {
                "requested": "2024-03-19T12:57:33.263Z"
            },
            "digits": "100"
        },
        "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/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Session-Key:SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS << JSON
{
    "meta": {
        "seed": "HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH"
    },
    "data": {
        "attributes": {
            "size": 1000,
            "digits": 100,
            "alphabet": "UPPER_VOWELS"
        },
        "type": "tokens",
        "relationships": {
            "payment": {
                "data": {
                    "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                    "ident": "pi_XXXXXXXXXXXXXXXXXXXXXXXX",
                    "type": "transaction"
                }
            }
        }
    }
}
JSON