vmwarevsphereesxivcenter

Vmware vsphere 7 api


I am trying to build a python program to automate vmware vsphere task. Currently i am running vsphere 7 esxi server. The problem is when I try to test the api using postman to list the vm's i get an empty array, but I can see the vm information on the vsphere web client without any problem

API call: https://host-ip/rest/vcenter/vm (header contains the session id created using the create session api)

Can someone say why this is happeningenter image description here


Solution

  • Unfortunately ESXi hosts do not have a REST API service. That service is only available through a vCenter Server. However, you could use the vSphere Web Services (SOAP) API. Since you reference Python, you could also check out the pyvmomi SDK that interacts with that API service.