Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 2.67 KB

File metadata and controls

44 lines (24 loc) · 2.67 KB

Task 2 - Obtain an Access Token

Create an App

  1. Follow the instructions on the walkthrough Create an App. When specifying API Access, ensure that "Design Automation API" and "Data Management API" are selected.

  2. Note down the Client ID and Client Secret of the app you created.

Save Client ID and Client Secret to Postman Environment Variables

In the DA4Revit environment that you selected earlier, there are two Postman Environment Variables named client_id and client_secret. By setting these variables, you won't need to specify their values when you send HTTP requests to APS.

To set the environment variables:

  1. Click the Environment quick look icon on the upper right corner of Postman. Environment quick look icon

  2. Click in the CURRENT VALUE column on the client_id row. The Edit icon displays.

    Edit Environment Variable

  3. Click the Edit icon, and enter the Client ID you jotted down earlier.

  4. Similarly, enter the Client Secret you jotted down earlier in the CURRENT VALUE column on the client_secret row.

  5. Click the Environment quick look icon again.

Get an Access Token

To get an Access Token, you must send an authenticate request to APS. The Postman collection has a pre-populated authenticate request that you can send. To send the request to APS:

  1. On the Postman sidebar, click Task 2 - Obtain an Access Token > POST Get an Access Token. The request loads.

  2. Click the Pre-request Script tab. Notice how a script (written in JavaScript) takes the Client ID and Client Secret, concatenates them, converts to a Base64 encoded string, and saves it back to a Postman Collection Variable named client_auth_keys. Preview Client Id and Client Secret

  3. Click Send. The request is sent to APS. If your request authenticates successfully, you should see a response similar to the following: Successful authentication

Postman saves the Access Token in the Postman Collection Variable dasApiToken. Postman picks up the Access Token from this variable for all subsequent requests. This variable eliminates the need for you to repeatedly specify the value of the token for subsequent requests.

◀️ ▶️