Skip to content

Thunder Client

Pan, Kevin Zhu edited this page Apr 20, 2022 · 1 revision

Background

Becuase popular REST API clients (Postman and Insomnia) require a paid subscription for teams, we are going to be using Thunder Client, a VS Code extension.

Setup

You can navigate to the extensions tab in VS Code and look up "Thunder Client," then install it. Once you have the extension installed, you can go to the extension settings and turn on "Save to Workspace" to be able to sync the requests with git. You may need to hit the refresh button at the top of the Thunder Client tab for requests to refresh.

In the thunderEnvironment.json file, paste the following:

[
  {
    "_id": "45c45303-4a84-46ff-9703-561b34cbf359",
    "name": "API token",
    "default": true,
    "sortNum": 10000,
    "created": "2022-04-20T17:08:24.841Z",
    "modified": "2022-04-20T17:11:06.216Z",
    "data": [
      {
        "name": "token",
        "value": ""
      }
    ]
  }
]

This will create an environment with the environment variable called 'token,' and we will use this variable in the 'Auth' tab. There should also be existing requests that show how environment variables are used (should be double curly braces "{{env_variable}}").

Authentication

We can generate tokens with the filesync app itself, after your auth through the /auth endpoint, you can copy the token into the environment variable. Because there is no (known) way to have a callback URL within Thunder Client, this is how we'll do authentication. Tokens expire after an hour, so if you are getting 401 unauthorized errors, try to make a new token by going through the /auth endpoint again.

Notes

For requests, we can use the naming convention that Forge uses for their endpoints. The existing endpoints should already be like this. You can find the API documentation here: https://forge.autodesk.com/en/docs/data/v2/reference/

Clone this wiki locally