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:

# export refresh_token="replace_with_your_Token"


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

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

3. Run the following command to confirm that the access_token was set as environment variable.

# echo $access_token
 

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


# curl -v https://<Org-endpoint>.tmc.tanzu.broadcom.com/v1alpha1/managementclusters/<MGMT_CLUSTER_NAME>/provisioners -H "Authorization: Bearer $access_token" | jq -r

Additional Information

Official VMware Documentation: How do I generate API tokens