I am trying to use API "/deployment/api/deployments/" in order to get all deployments from vRA. But unfortunately, I am getting only 20 elements out of 276 elements. How can I get all ?
Is there way to get data from all pages ? I tried to make use of $top=500 and able to get only 200 elements.
Did anyone find an answer to this? I too am getting limited results of 200 (assuming that's a single page of results). I've tried the ?size=1000 and the ?top=1000 but either way it seems to be limited to 200 results per page with no obvious way to change pages.
I find the documentation around the vRA 8 API for filtering, pagination, etc. extremely lacking. There are some examples in the Programming Guide, but no overarching docs that just tell you how to use it in general.
That said, I think maybe the $skip param is needed here. I don't think you can get them all at once, but I think you can manage to paginate by setting the $top param for the number per page and the $skip param to <page number>*$top
For example, with 100 per page:
Page 0: /deployment/api/deployments?$top=100&$skip=0
Page 3: /deployment/api/deployments?$top=100&$skip=300
Funny, I was just testing out that skip parameter and using that to return pages. Still kind of frustrating though having to do multiple REST calls and concatenate the data vs just returning all the deployments in one call. Thanks
It seems that the return size of REST API calls is generally limited to 200 elements. I tried /deployment/api/resources with the top parameter of 1000 and it delivers 200 elements, not more. It always seems to be a good idea to request the keys totalElements and numberOfElements to detect differences and to iterate at the result.
Create a count variable equal to 200, then increment it until it equals the total count of all resources.
your uri would be:
fqdnofVRA + /deployment/api/deployments?'$top=200&'$skip=$($count)
that's the gist of what our powershell looks like.
Can't claim any credit for this though. Just passing it along in the hopes it helps someone.
The iaas api does not seem to have the same limitation. Downside is /iaas/api/deployments does not have all the same options such as being able to return soft deleted deployments.
Article has script which goes through all the pages and then collect the data from each deployment related to vsphere machine