vCenter

 View Only
  • 1.  REST API VM list filtre like

    Posted May 24, 2022 04:22 PM

    Hello,

    I want to use VMWare REST API for finding VM. I want to find the VMs with a name 'PW-XXX'. I use /rest/vcenter/vm, but there are too many VM, so I must add a filtre. But I don't have the full name of VM. I want to find all VM with name like 'PW-XXX'. I don't know how can I do. Thanks for your reponse.



  • 2.  RE: REST API VM list filtre like

    Posted May 24, 2022 05:16 PM

    Hi, you need to specify what programming language you are using and also paste in the code segment you have so far.

     

    If you're using PowerShell, all you need to do is run a match on the array of VM names returned.



  • 3.  RE: REST API VM list filtre like

    Posted May 24, 2022 05:23 PM

    Hello, thanks for your reply. 

    The problem is I can’t get vm list via rest api. Because in the réponse json, if it have more than 1000 vm, we can’t get all vm by rest api. It must have a filter in url, vm/filter.name=xxx. It must use a full host name. I don’t have the full host name, 



  • 4.  RE: REST API VM list filtre like

    Posted May 24, 2022 05:46 PM

    Unfortunately this is a known vCenter REST API issue or limitation.

    You may need to write your solution with PowerShell/PowerCLI using the SOAP API.

    Alternatively, you could log an SR with VMware SDK support, if you have this ability.



  • 5.  RE: REST API VM list filtre like

    Posted May 25, 2022 10:12 AM

    Thanks