Automation · VMware Automation
vSphere API
Cheat sheet · https://pcornel.dk/topic.php?topic=5733
Answer
The vSphere API is the SOAP and REST interface to vCenter and ESXi used by PowerCLI, govc, pyVmomi, Terraform and Ansible, giving access to all inventory and operations.
Remember
- The vSphere API has SOAP and REST interfaces.
- All tools use it.
- Sessions expire.
First checks
curl -s --cacert vcenter-ca.pem -X POST -u <user> https://<vc>/api/session— session token with verified TLScurl -s --cacert vcenter-ca.pem -H 'vmware-api-session-id: <token>' https://<vc>/api/vcenter/vm— list VMsgovc ls /<dc>/vm— govc
Verify in this order
client → session → REST/SOAP → vCenter
Where it usually breaks
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5733