Test

Before you run a test REST API call, ensure that you have installed Transaction Manager for Microservices and there is an application running to interact with the REST API.

You can use run a sample application that available in the installation bundle or create and run your own application. You can also use cURL commands or REST clients to test REST APIs before you implement them in your application.

Testing with cURL

Invoke cURL and specify one or more of the command-line options listed in the following table, as required, to test REST API calls.

Option Description
-X Indicates the type of request (for example, GET, PUT).
-H --header Specifies the authentication cookie in the request header.
-d, --data @file.json Identifies the request document, in JSON format, on the local machine.

For additional details about the available options for the version of cURL that you have installed, refer to the official cURL documentation.

Send a Request Using cURL

After you set up your REST client, you can send a request to ensure that your connection works. Use the GET HTTP verb to retrieve all the transaction details for a specific transaction protocol. For example, to view details of all XA transaction you can use the following request:

Sample cURL command

curl -X GET
     -H "Authorization:Bearer $OTMM_COOKIE" 
      https://192.0.2.1:8080/admin/v1/xa-transaction

OTMM_COOKIE is the name of the variable in which you stored the authentication token earlier. For information about retrieving the authentication token and storing it in a variable, see Authenticate.

If the request is successful, then you should receive a 200 response with a body such as the following:

{
    "more": false,
    "transactions": [
        {
            "begin": 1656909341649,
            "encryptedEntry": "Rw/egNz7....",
            "end": 0,
            "gtrid": "e6808684-5d8c-4ad0-90d2-345a225d0f02",
            "hostname": "otmm-tcs-6499...",
            "keyVersion": "1",
            "nonce": "HUnUlVyEhiFjJSU/",
            "status": "Created",
            "thumbprint": "Bearer eyJhb....",
            "timeout": 600000,
            "userId": "43225c1..."
        }
    ]
}

Example values have been truncated with ... to improve readability. When you view the response in your environment, you'll see the entire value.