top of page
Writer's pictureMohammed Bilal

Procedure for Performing Operations with API - Part 2

Continuing the further steps in this part:

  • Generate an Access Token Using Postman

  • Use Postman to View a List of SDDCs

  • Update Environmental Variables in Postman

  • Use Postman to Get Primary Cluster Information

Generate an Access Token Using Postman:


You generate an access token in Postman using the API token that you created in an earlier task.


After you generate an API token, you can use it to interact with VMware Cloud service APIs by exchanging it for an access or authorization token.

  • In the left pane, expand VMware Cloud on AWS

  • Select POST Log in

  • Click the Tests tab

The code that is shown takes the API response and stores the access token as an environment variable.

  • Click Send

The response from the API request displays.

  • Click the eye icon at the top-right of the page

An access_token variable is shown.

  • Click the eye icon again to close this page


Use Postman to View a List of SDDCs:


You run a GET command in Postman to display a list of your SDDCs.

  • In the left pane, click List SDDCs

The API URL contains a {{org_id}} variable. This API request uses the org_id variable that you defined in the Postman environment.

  • Point to {{org_id}} to display the value of the variable

  • Click the Authorization tab

  • Point to {{access_token}} to display the value of the variable

The value was generated by the POST login API that was used in the previous task.

  • Click Send

The response from the API request is displayed.

  • Locate the sddc_id value

  • Copy and paste the sddc_id value into Notepad

The value should match the sddc id copied from the VMware Cloud API Explorer.


Update Environmental Variables in Postman:


You update the environment variables in Postman to include an SDDC ID variable.

  • Access the Environment Management window

    • Click the eye icon in the top-right corner of the page

    • Click edit

  • Update the Postman environmental variables

    • In the Add a new variable text box, enter sddc_id

    • Click the Current value text box and paste the sddc_id value that you copied in the previous task

    • Click Update

    • Click X in the top-right corner of the Manage Environments window


Use Postman to Get Primary Cluster Information:


You run a GET command in Postman to display a list of your clusters.

  • In the left pane, click Get Primary Cluster

The API URL contains a {{org_id}} variable and {{sddc_id}} variable. This API request uses the variables that you defined in the Postman environment.

  • Point to {{org_id}} to display the value of the variable

  • Point to {{sddc_id}} to display the value of the variable

  • Click Send

The response from the API request is displayed

  • Locate the hostname value

  • Verify that the IP address value for the hostname parameter matches the IP address of the ESXi host in your VMware Cloud environment


42 views0 comments

Recent Posts

See All

Comments


bottom of page