VMware Cloud Community
dgberrid
Enthusiast
Enthusiast

vRealize 7 Rest API: Get Virtual Machine Resource from Deployment

I have been trying to use the rest api to get a virtual machine resource from a deployment. I have been using some fields in my filter but I am having trouble getting some to work properly. For instance, if I know the request id from my deployment I can use the requestId field in the resource...

"requestId":"<request id>"

and use that to filter for resources with that request id by making the following rest call...

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/id eq '<request id>'

But what I would really like to do is to find resources based on the resource's deployment id. Looking at the json response from the deployment I see there is a parentResourceRef field on the virtual machine resource with a subfield, id, that matches the deployment id.

"parentResourceRef":{
  "id":"<deployment id>",
  "label":"<deployment label>"
}

This is the field I really want to filter on but all of my attempts have failed...

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=parentResourceRef/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=parentResourceRef eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=parent/resource/ref/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=parent/resource/ref eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parentResourceRef/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent/resource/ref/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent/resource/ref eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent/resource/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent/id eq '<deployment id>'

https://<vra fqdn>/catalog-service/api/consumer/resources/?$filter=request/parent eq '<deployment id>'

Am I missing something or is this not possible?

Labels (2)
0 Kudos
1 Reply
Adiel_Gilboa
Contributor
Contributor

You can do it using resourceViews as the following : 

https://<vRA-FQDN>/catalog-service/api/consumer/resourceViews?$filter=parentResource eq '<DeploymentID>'

 

0 Kudos