With the release of 6.5, there is an improved focus on using vcenter REST API’s
In this example, I am trying to explore the vcenter 6.5 api specifically vcenter 6.5 VCSA using python.
Make sure you install the required packages so that it will work like request,urlopen etc. pip can be used to install the same, there might be more packages depending on your setup.
#sudo pip install requests
#sudo pip install urlopen
How to get the details of the API?
Connect to the VCenter using the browser.
Click on the Right-hand corner “Browse vSphere REST APIs”
How to Explore the vcenter API’s?
Once you click on browse select API for which you would like to have more details.
How to access the API?
Using GET/PUT method to access the details.
Attached is an example to query the health status of the VCSA appliance.
It will print the messages based on the health status
$ python vcenterapi.py
The Health status of the appliance is: GREEN
VCSA health status is fine