Pagination controls the number of elements or the range of elements returned in an API response. When the count flag is specifed, the response shows the total number of records. Use parameters in combination to traverse all elements in a result.

To paginate a response, you use the following parameters.

$top=N

Selects only the first N elements of the set. N must be a positive integer. Specifying N limits the maximum number of elements that the server returns in the response.

The default IaaS API page size is 100. If $top is left unspecified, pagination selects the first 100 elements. If you want the output to include elements beyond the first 100 elements, specify a top value greater than 100.

$skip=N Skips N elements and selects only the remaining elements starting with element N+1.

Pagination examples

The following examples show how to combine parameter values to control the elements returned in a vSphere deployment with 45 cloud accounts.
If you want to... Use this request
List the first 20 cloud accounts, or 1–20
curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts?apiVersion=$api_version&$filter=cloudAccountType%20eq%20%27vsphere%27&$top=20&$skip=0"  | jq "."
List the second set of 20 cloud accounts, or 21–40
curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts?apiVersion=$api_version&$filter=cloudAccountType%20eq%20%27vsphere%27&$top=20&$skip=20"  | jq "."
List the third set of 20 cloud accounts, or 41–45
curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts?apiVersion=$api_version&$filter=cloudAccountType%20eq%20%27vsphere%27&$top=20&$skip=40"  | jq "."

Count example

The following example shows how to count the AWS cloud accounts.

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts?$filter=cloudAccountType%20eq%20%27aws%27&$count=true" | jq "."