使用邮递员请求按文件夹恢复 Vsphere VM?

问题描述

我尝试使用来自邮递员的请求按文件夹恢复每个虚拟机。

通过此请求,我可以列出我的 vsphere 中的每个文件夹:

GET https://SERVER/rest/vcenter/folder

使用第二个命令,我可以列出 vpshere 中的每个虚拟机:

GET https://SERVER/rest/vcenter/vm

我想知道是否有办法获取文件夹和其中的每个 VMS?

类似:

GET https://SERVER/rest/vcenter/folder/my_folder

输出如下:

"value": [
        {
            "folder": "XXX","VMs" : {
                VM1
                VM2
                ...

或者类似的东西?

非常感谢!

解决方法

http://vmware.github.io/vsphere-automation-sdk-rest/6.5/operations/com/vmware/vcenter/folder.list-operation.html

&filter.parent_folders.1=obj-103

它支持查询参数 parent_folders ,所以 url 会像

GET https://SERVER/rest/vcenter/folder?filters.filter.parent_folders.1=obj-103

甚至 VM 也支持名为文件夹的过滤器:

http://vmware.github.io/vsphere-automation-sdk-rest/6.5/operations/com/vmware/vcenter/vm.list-operation.html