[VMC on AWS] Unable to list more than 1000 objects using NSX VMC Policy API
search cancel

[VMC on AWS] Unable to list more than 1000 objects using NSX VMC Policy API

book

Article ID: 329669

calendar_today

Updated On:

Products

VMware Cloud on AWS

Issue/Introduction

This article provides information on how to retrieve all object using NSX VMC Policy API.

Symptoms:
Unable to list more than 1000 objects using NSX VMC Policy API.
For example, only 1000 groups are displayed when there are VMC NSX-T groups more than 1000 using REST API like this:


https://nsx-xxx-xxx-xxx-xxx.rp.vmwarevmc.com/vmc/reverse-proxy/api/orgs/${org_id}/sddcs/${sddc_id}/policy/api/v1/infra/domains/cgw/groups

Cause

API allows to retrieve all results but an individual request max out at 1K.

Resolution

We can use result_count to help us determine the total number of entries, and then using the cursor property to iterate through the different pages. If we’ve got total of 10K, then we need to make 10 API calls (each returning 1K entries).

For example, the following result can be seen when we get /infra.domains/cgw/groups.

  "result_count" : 10000,
  "sort_by" : "display_name",
  "sort_ascending" : true,
  "cursor" : "00041000"


Then we can use like /infra/domains/cgw/groups?cursor=00041000 as requested URL if we need to get next 1K result.

Please refer to the following articles for further information.

NSX VMC Policy API API Guide
https://vdc-download.vmware.com/vmwb-repository/dcr-public/62b26deb-b411-41e5-82ad-9375d3777cbe/66dc4337-e5ad-402a-9718-eb6854861775/nsx_api_vmc.html


Additional Information

VMware now offers Developer Support services to assist you with best practices, sample code, and guidance. If you need more assistance, please consider purchasing VMware SDK and API Support program.

VMware SDK and API Support
https://www.vmware.com/support/services/sdk.html

VMware SDK Developer Support Program (1029840)
https://kb.vmware.com/s/article/1029840