vmware vsphere 7 api

问题描述

我正在尝试构建一个 python 程序来自动执行 vmware vsphere 任务。目前我正在运行 vsphere 7 esxi 服务器。问题是当我尝试使用邮递员测试 api 以列出 vm 时,我得到一个空数组,但我可以在 vsphere web 客户端上看到 vm 信息,没有任何问题

API 调用:https://host-ip/rest/vcenter/vm(header 包含使用 create session api 创建的 session id)

谁能说说为什么会这样enter image description here

解决方法

遗憾的是,ESXi 主机没有 REST API 服务。该服务只能通过 vCenter Server 获得。但是,您可以使用 vSphere Web Services (SOAP) API。由于您引用了 Python,您还可以查看与该 API 服务交互的 pyvmomi SDK。