Postman Collection for Tanzu Mission Control REST APIs
Tags: vmware, api, postman, tmc
Published: 2021-06-28 10:11:06

---
title: Postman Collection for Tanzu Mission Control REST APIs
published: true
date: 2021-06-25 08:58:36 UTC
tags: VMware,API,Postman,TMC
canonical_url: https://veducate.co.uk/postman-tmc-api/?utm_source=rss&utm_medium=rss&utm_campaign=postman-tmc-api
---

Whilst working with vRA to deploy various Kubernetes clusters and then register them with Tanzu Mission Control (TMC), I decided to use Postman (a great API Explorer tool) to catalogue my work and build out several use cases.

I’ve posted this here:

- [VMware Code Sample](https://code.vmware.com/samples?id=7629)
- [Github Repository](https://github.com/saintdle/Tanzu-Mission-Control-API-Postman-Collection)

This collection was created from the [TMC API Documentation](https://code.vmware.com/apis/1079/tanzu-mission-control). This API is version “v1alpha1” and should be treated as such.

So far, I’ve created the following areas/use cases:

- Login
- Audits
- Attach Cluster
- List Cluster/s
- Cluster Group/s management
- Data Protection management
- Cluster Inspections

###### Variables inside the collection

I have opted to create the variables inside the collection itself, rather than a separate environment.

Some of the API requests have tests associated, which will populate your variables for you.

You will need your TMC URL and a [VMware CSP API Token](https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-E2A3B1C1-E9AD-4B00-A6B6-88D31FCDDF7C.html) as your starting point.

[![TMC API - Postman Collection - Collection Variables](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Collection-Variables.jpg?resize=604%2C325&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Collection-Variables.jpg?ssl=1)

###### Documentation

Where the requests require some changes in the body that is best not to have as a variable, such as naming a backup, I’ve also tried to add information on the documentation.

[![TMC API - Postman Collection - Collection Documentation](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Collection-Documentation.jpg?resize=604%2C368&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Collection-Documentation.jpg?ssl=1)

###### Getting Started

Under the Login folder, run “Get Access Token”, which will connect to your TMC URL and use the CSP Refresh Token to generate an Access Token, this access token will be committed to a variable called “accessToken” for use with the other requests.

[![TMC API - Postman Collection - Login](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Login.jpg?resize=604%2C387&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/06/TMC-API-Postman-Collection-Login.jpg?ssl=1)

You will also probably want to run the “Get Organisation ID” as some of the requests require your Org ID, so this will commit it to a variable. This is gathered by looking at the details for your given CSP Token.

###### Attach Cluster

If you are running the API to attach a new cluster. Then you will want to run the second request “Get TMC Agent Installer information” which will give you the Installer Link to run in your Kubernetes environment. This data will be written to a variable.

###### **List Clusters**

For most of the request that List information, you can use the query “?searchScope.name=” with the API call to filter for necessary objects, or you can use the wildcard value \*. I’ve added most of the search filters and value formatters to the requests.

To get the full details for a particular named cluster, I have written the queries for specified clusters, this requires you to provide the management cluster and provisioner of that specified cluster in the query. Essentially it returns the same information as the “Get Clusters List” combined with the SearchScope filter.

###### Wrap-up

So, I won’t describe every set of requests I’ve created. I’ve tried to create these with the bare minimum information you need especially for the POST methods.

If you want to explore the APIs more, you can download an import the [Swagger/Open API spec](https://vdc-download.vmware.com/vmwb-repository/dcr-public/f7fb1f70-369c-44d2-a02f-f9ed9ceba3fb/faf3c7ca-e8f7-47bd-a433-0d11ba76b7d7/openapi_v1alpha1-swagger.yaml) from VMware yourself and import into Postman, but personally I found this hard to work with, and the example bodies give you everything including the responses you won’t need for a POST.

If you’d like to contribute, please do this via the GitHub link!

Looking for more resources around TMC? Then you can check out my other blogs!

```
Tanzu Mission Control 
- [Getting Started Tanzu Mission Control](https://vEducate.co.uk/vmware-tanzu-mission-control-getting-started) 
- [Cluster Inspections](https://vEducate.co.uk/vmware-tanzu-mission-control-cluster-inspections) 
- [Workspaces and Policies](https://veducate.co.uk/vmware-tanzu-mission-control-workspaces-and-policies/) 
- [Data Protection](https://veducate.co.uk/?p=3429&preview=true) 
- [Deploying TKG clusters to AWS](https://veducate.co.uk/tmc-deploy-tkg-aws/) 
- [Upgrading a provisioned cluster](https://veducate.co.uk/tanzu-mission-control-upgrade-cluster/) 
- [Delete a provisioned cluster](https://veducate.co.uk/tanzu-mission-control-delete-provisioned-cluster/)
- [TKG Management support and provisioning new clusters](https://veducate.co.uk/tmc-tkg-management-provisioning/)
```

Regards

[Follow @Saintdle](https://twitter.com/saintdle)<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

[Dean Lewis](https://uk.linkedin.com/in/saintdle?trk=profile-badge)

The post [Postman Collection for Tanzu Mission Control REST APIs](https://veducate.co.uk/postman-tmc-api/) appeared first on [vEducate.co.uk](https://veducate.co.uk).