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:
Operations Covered in this Collection: Login Get Provider Health Get Organsation Users Get Users Create Users Change Password for Current User Databases Get Databases Specific Database Get Root & Admin User Passwords Get Database Alerts Get Database Version Create Database Delete Database Backup Create & Restore (inc. Point in Time Restore) Logs Create, Download, Delete Get Environment Get Templates Instance Plans Get All, Create and Delete Get Tasks, Events and Alarms Get All Backups Get Audit Logs
Variables inside the collection
The main variables you will need to set before use are:
- baseUrl
- userName
- Password
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.
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:
- You have five definitions to choose from which offer different capabilities
- Authentication
- Provider
- Monitoring
- Appliance
- 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.
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
- Getting Started – Deploying and configuring the infrastructure
- Self-Service DBaaS – How to use the platform to create DBs on demand
Regards