When querying resources via the API, using the default page size of 20 correctly reports the total number of elements. However, requesting the exact same information with a larger page size (e.g., 100) results in an incorrect total number of elements being reported.
Example:
curl 'https://vra/deployment/api/resources?page=0&size=20' | jq '.totalElements'
92k
curl 'https://vra/deployment/api/resources?page=0&size=100' | jq '.totalElements'
97
VMware Aria Automation 8.18.1
Workaround:
To accurately retrieve resources and paginate through them, use the $skip and $top parameters instead of page and size, and monitor the "last" property in the API response to determine when all pages have been retrieved.
Example:
curl 'https://vraurl/deployment/api/resources?sort=createdAt&$top=100&$skip=0'
curl 'https://vraurl/deployment/api/resources?sort=createdAt&$top=100&$skip=100'