DEV Community

Dean
Dean

Posted on • Originally published at veducate.co.uk on

Data Management For VMware Tanzu API Postman Collection

Whilst working with the “Data Management for VMware Tanzu” product, I decided to have a stab at working with the API as well.

Using my favourite API tool, Postman, I created an easy-to-use collection.

I’ve posted this here:

The commands in this collection are built from the Swagger API, which can be accessed from the following URL:

The official documentation for the API can be found here.

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

  • Get/Create Organisation
  • Get/Create/Delete User
    • Get/Reset User Passwords
  • Get/Create/Delete Database
    • Get Database configuration details
  • Get Environments
  • Get Database Templates
  • Get/Create/Delete Instance Plans
  • Get Provider Appliance Health
Variables inside the collection

The main variables you will need to set before use are:

  • baseUrl
  • userName
  • Password

Data Management for Tanzu - API Postman Collection - Variables

Getting Started

Under the login folder, run the “Get Access Token” request. This has a test configured, so that from the returned data, it will copy the Bearer Token and OrgId for the User Account to the Environment Variable collection that is active.

Data Management for Tanzu - API Postman Collection - Get Access Token

Some API requests are only valid for certain Authenticated role types, such as creating Databases can only be successful with a user role of Org_Admin or Org_User.

How did I create this?

I used the Swagger UI to validate the requests. Which you can access by browsing to:

  • https://{Provider}/provider/swagger-ui/index.html

Then in the Swagger UI:

  1. You have five definitions to choose from which offer different capabilities
    1. Authentication
    2. Provider
    3. Monitoring
    4. Appliance
    5. Update Manager
  2. This small blue hyperlink is a YAML download or Raw API format file, you can import or paste this into Postman. Which will then understand the schema provided and create a collection where possible.
  3. In the SwaggerUI you can authorize yourself as a user for testing the various API Calls.
  4. You can try all the available API calls tested. Be warned this will be live on your system.

Data Management for Tanzu - API Postman Collection - Swagger UI

Why did you create this collection if we can just use Swagger?

Downloading the files from Swagger UI and importing them into Postman does create you a collection and API to use.

However, the importing of this may not be easily useable, and the example body for POST methods for example will display every single possible “key:value” pair. Also the URL wouldn’t be accurate for use straight away, as you’d need to input the definition. So again, if you were new to using APIs this might be a bit too complex too soon.

I’ve included a screenshot of importing the files from Swagger and what they look like once they are available.

Data Management for Tanzu - API Postman Collection - Import file Data Management for Tanzu - API Postman Collection - Import file 2

I decided to create a cleaner simpler collection, and for the Body requests focus on the minimum information you would need to get going as well.

Wrap-up

So hopefully this is helpful to anyone using this new VMware product. You can also view my blog posts which take you from Zero to using Database as a Service features as quickly as possible.

  • Data Management for VMware Tanzu

Regards

Follow @Saintdle

Dean Lewis

The post Data Management For VMware Tanzu API Postman Collection appeared first on vEducate.co.uk.

Discussion (0)