Reference: Integration with Insomnia API Client

You can upload a Tanium API Gateway example requests JSON file to the Insomnia API client, configure communications between Insomnia and the Tanium ServerTanium Cloud, and submit example requests and receive responses. Insomnia can also parse the example requests and generate code samples based on the requests.

Prerequisites

Configure Insomnia to communicate with Tanium

Back up your workspace before importing a JSON file. If you previously imported a Tanium API Gateway example requests JSON file and made updates in the workspace, then import another JSON file into the project, it might overwrite your workspace changes.

  1. In the Insomnia client, click + next to Projects.

  2. Enter a project name, then click Create.

  3. From the new project, select Create > Request Collection.
  4. Enter a collection name, then click Create.
  5. Select collection_name > Import/Export > Import.
  6. Select the Tanium API Gateway Insomnia example requests file, then click Scan.

  7. Click Import.
  8. Select project_name > collection_name. Confirm that the import succeeded and the example syntax is loaded.

    If you previously imported a Tanium API Gateway Insomnia example requests file into a project or collection, the import might overwrite your existing workspace.

  9. From the new project, select No Environment > Manage Environments.
  10. Copy the following JSON object, then paste it in the Base Environment pane:

    Copy
    {
      "url": "https://",
      "path": "/plugin/products/gateway/graphql",
      "api_token": "token-string"
    }
  11. Update the url value to the Tanium Server URL.

  12. Update the url value to https://<customerName>-api.cloud.tanium.com, replacing <customerName> with your Tanium Cloud instance domain name.

  13. Update the api_token value to the API token string associated with your integration user. Click Close.

Verify integration

  1. In the Insomnia client, select project_name > collection_name

    .
  2. Expand General examples and then click Time. Verify that the request path is POST _.url_.path.

  3. Click Header and verify that the session header is set to the _.api_token variable, and that the Content-Type header is set to application/json.

  4. Click Send. The API Gateway service responds with the current system time, such as the following:

    Copy
    {
      "data": {
        "now": "2021-11-08T19:22:03Z"
      }
    }

Generate code example from example request

  1. In the Insomnia client, right-click an example, then select Generate Code.

  2. Select a language from the drop-down, then an associated library from the drop-down. The code example updates as you select a language and library.