0 Replies Latest reply on Aug 15, 2019 7:17 PM by Stephon_Chen

    [Bug] Listing resources through API returns different results with / without paging

    Stephon_Chen Lurker

      Hello all,

       

      I am wondering that listing resources through API returns different results with / without paging.

      Setup is as the following:

       

      • vRA version: 7.3
      • VM counts in the tenant: 99
      • Steps
        • Without paging (limit = 999)

      curl -s --data-urlencode "orderby=name asc&filter=(resourceType/id eq 'Infrastructure.Virtual' and organization/subTenant/name eq '${TENANT_NAME}' and outputResourceType/name eq 'VirtualMachine')" -k -X GET "https://${VRA_HOST}/catalog-service/api/consumer/resources?limit=999" -H 'Accept: application/json' -H "Authorization: Bearer ${VRA_TOKEN}"

          • Output VM count: 99
        • With paging

      for i in `seq 1 3`; do

                  curl -s --data-urlencode "orderby=name asc&filter=(resourceType/id eq 'Infrastructure.Virtual' and organization/subTenant/name eq '${TENANT_NAME}' and outputResourceType/name eq 'VirtualMachine' and catalogItemType/name eq 'VirtualMachine')" -k -X GET "https://${VRA_HOST}/catalog-service/api/consumer/resources?limit=${LIMIT}&page=${i}" -H 'Accept: application/json'  -H "Authorization: Bearer ${VRA_TOKEN}"

        • While
          • limit = 40, VM counts: 61
          • limit = 50, VM counts: 73
          • limit = 60, VM counts: 91
          • limit = 70, VM counts: 99 (correct)

       

      Even if referring to bug in pagination at path "/catalog-service/api/consumer/resources?limit=20" duplicate machines returned

      Order by has no effect, as sample testing command above mentioned.

       

      From my perspective, I want to fetch VM counts in parallel way to speed up.

      What's the better way to achieve this goal?

       

      Thanks a lot.