This post was originally published on this site
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:
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.
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:
Then in the Swagger UI:
- You have five definitions to choose from which offer different capabilities
- Update Manager
- 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.
- In the SwaggerUI you can authorize yourself as a user for testing the various API Calls.
- You can try all the available API calls tested. Be warned this will be live on your system.
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.
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.
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
The post Data Management For VMware Tanzu API Postman Collection appeared first on vEducate.co.uk.