top of page

Procedure for Performing Operations with API - Part 1

Writer's picture: Mohammed BilalMohammed Bilal

You can use the VMware Cloud API Explorer and Postman application to make API requests to VMware Cloud services:

  • Run API Commands Against VMware Cloud on AWS

  • Generate a New API Token in VMware Cloud Services

  • Create an Environment in Postman by Using a Token

  • 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


Run API Commands Against VMware Cloud on AWS:


You use the VMware Cloud services API Explorer to run API commands against VMware Cloud on AWS.


  • From the VMware Cloud console browser tab, access the Developer Center

    • On the VMware Cloud home page, click Developer Center on the left pane

    • Click the API Explorer tab

  • Use the API Explorer to obtain your SDDC ID

    • Under Available APIs, click VMware Cloud on AWS to expand the menu

  • Click General

The general API categories displays

  • In the API categories list, click sddc to expand the menu. The list of sddc APIs displays

  • In the list of sddc APIs, click GET /orgs/{org}/sddcs/

The List of all SDDCs in the organization is expanded

  • Scroll down to the Try it out the section of the API. The org value is auto-populated

  • Copy and paste the org ID into Notepad

Setting Value

Org ID (Record in Notepad)

  • Click EXECUTE

The API response displays

  • Under Response, click your SDDC name link to expand the API response. Details about the SDDC are shown

  • Under your SDDC name link, locate the "id": parameter

Sddc (your name)
  {  "account_link_state": null, 
"created": "2021-04-28T21:46:40.000102Z",
"expiration_date": null, 
"id": "261f0022-047c-48e2-a1b3-74452940a4f6", 
"name": "student2", 
"org_id": "a75a5cfb-002d-4dab-b291-47fc070ac34c", 
"provider": "AWS", 
"resource_config":
  • Copy and paste the SDDC ID into Notepad

Setting Value

SDDC ID (Record in Notepad)

  • Use the API Explorer to obtain your cluster details

    • Under Available APIs, click VMware Cloud on AWS to expand the menu

    • In the list of sddc APIs, click GET /orgs/{org}/sddcs/{sddc}/primarycluster

The Retrieves the primary cluster in provided customer sddc UUID API is expanded

  • Scroll down to the Try it out section of the API

The org value is auto-populated.

  • In the sddc text field, paste in the ID value copied in the previous step

  • Click EXECUTE

The API response displays.

  • Under Response, click the cluster link to expand the API response

Details about the cluster are shown

  • Click the AwsEsxHost (esx-0) link to expand the view

  • Under AwsEsxHost (esx-0), locate the "hostname": parameter

AwsEsxHost (esx-0)
  {  
"availability_zone": "us-west-2b", 
"custom_properties":  
{}, 
"esx_id": "006d0cd8-5c93-4c16-b7ed-62d9c9bf17ac", 
"esx_state": "READY", 
"hostname": "10.202.2.4", 
"instance_type": "i3.metal", 
"internal_public_ip_pool":  
[
  • Verify that the IP address value for the hostname parameter matches the IP address of the ESXi host in your VMware Cloud environment

Generate a New API Token in VMware Cloud Services:


You generate a new API token and copy the token so that you can use it later.

  • From the VMware Cloud console browser tab, access user account settings

    • On the VMware Cloud home page, click your user name in the top-right of the page

    • Under USER SETTINGS, click My Account

  • Generate an API token

    • Under My Account, click API Tokens

    • Click GENERATE A NEW API TOKEN

  • In the Token Name text box, enter your name-token

  • Click the Token TTL drop-down menu and select days

  • Under Organization Roles, select the Organization Member check box

  • Under Service Roles, select the VMware Cloud on AWS check box

  • Click GENERATE

A new token is generated

  • Click COPY and paste the token into Notepad

Setting Value

API Token (Record in Notepad)

  • If the COPY button does not copy the token to the clipboard, highlight the entire token string, right-click, and select copy

  • Click CONTINUE

Create an Environment in Postman by Using a Token:


I used Postman to create an environment and set it as your default environment.

  • Install Postman in your system and click the Postman icon to open

  • Configure Postman environmental variables

    • Click New

    • In the Create New tab, click Environment

    • In the Environment Name text box, enter VMC

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

  • In the Current value text box, paste the token that you generated in the previous task

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

  • In the Current value text box, paste the org value that you copied in the previous task

  • Click Add

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

  • In the No Environment drop-down menu, select VMC to make it your default environment



49 views0 comments

Recent Posts

See All

List of AWS services and their description

Recently I completed the AWS associate architect training and thought of collating all the AWS services and their description into a...

Komentarze


Subscribe Form

Thanks for submitting!

©2022 by virualbug.in

bottom of page