I am using API for quite a bit now in our prod environment which is based on vCloud Director and many times API’s had proved a handy way to troubleshoot issues where GUI was not providing a way to proceed.
Inspired by vCD API’s, i decided to test that in my vSphere 6.5 lab and in this post I will try to demonstrate few queries which can be helpful in fetching info in your infrastructure.
In my lab I am exploring REST API’s using a linux tool called curl.
1: You can browse list of API’s by browsing https://vcenter-fqdn/ and clicking on “Browse vSphere Rest API’s”
2: To start with you can use below query to see what are the different options available
# curl -sik -H ‘Accept:application/json’ -u “vc-user” -X GET https://vcenter-fqdn/rest/
You will see below URL’s in output:
1 2 3 |
https://vc-fqdn/rest/com/vmware/vapi/rest/navigation/component https://vc-fqdn/rest/com/vmware/vapi/rest/navigation/resource |
3: You can list the available components which can be explored via REST API by using below query
# curl -sik -H ‘Accept:application/json’ -u “vcadmin@alex” -X GET https://vcentersrv03.alex.local/rest/com/vmware/vapi/rest/navigation/component… Read More