Highlighted
Contributor
Contributor

vrops rest api, how to get a list of virtual machines including the powered off ones

Hi,

I am new to using the vrops rest api.  I am trying to get a list of vm's for a host including the powered off ones.  What I've noticed is that it only gives the running vm's.  I would start by

getting the resources for the host via the resourceid, for example,  "https://vrops_server/suite-api/api/resources/id_number", then to get the vm's, I would use the "relationsofResource" link that it returned.  I see all the running vm's but not the powered off ones.  Would anyone know how to achieve this?

thanks in advance,

0 Kudos
2 Replies
Highlighted
Contributor
Contributor

Actually, I just found out all the unlisted vm's are "templates".  Is there a way in the vrops rest api, to list out the templates for a host?

thanks,

0 Kudos
Highlighted
Hot Shot
Hot Shot

It's odd... I don't see any relationship between the templates and their host in vROps.  Using relationsofResource is the right idea, but doesn't look like it will work for templates.  You could try using the property "summary|parentHost".  This is getting both VMs and templates for me.  You'll have to query by the hostname as it appears in vROps like this:

https://{{vrops}}/suite-api/api/resources?propertyName=summary|parentHost&propertyValue=hostname.domain.com

If you want to handle the templates separately you can get all the templates using the isTemplate property:

https://{{vrops}}/suite-api/api/resources?propertyName=summary|config|isTemplate&propertyValue=true

And then get the parent host property for each template.

0 Kudos