Accessing the Tanzu Mission Control (TMC) API
search cancel

Accessing the Tanzu Mission Control (TMC) API

book

Article ID: 327449

calendar_today

Updated On:

Products

Tanzu Mission Control

Issue/Introduction

TMC provides a robust API with a range of endpoints, empowering you to efficiently manage and automate your infrastructure.


Resolution

In order to access and interact with the TMC API, please follow the steps below:
 

Generate the API Token:
 

1. Log into the Close Services Console, click your user name on the Cloud Services Console toolbar, and select My Account > API Tokens.

2. Click the Generate a New API Token link, enter a name for the token, and specify the desired lifespan of the token.

3. Define scopes for the token, you can read more about the limits here.

4. Click "Generate" and save the token in a secure place.

NOTE: For security reasons, after you generate the token, we only display the name of the token on the API Tokens page and not the token credentials. This means that you will no longer be able to reuse the token by copying the credentials from this page.
 

Get the Access Token:

1. Save the API Token in a variable:

refresh_token="replace_with_your_Token"


2. Get the Access Token used to interact with the TMC API:

access_token=$(curl -d "refresh_token=$refresh_token" https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize | jq -r '.access_token')
 

3. You have now access to the TMC API, please find below an example of interacting with the API endpoint "TanzuKubernetesClusterResourceService":

https://lab-env.tmc.cloud.vmware.com/v1alpha1/managementclusters/tkgs-nsx/provisioners/tkgs-nsx/tanzukubernetesclusters/tkc-nsx -H "Authorization: Bearer $access_token"

Additional Information