Using Pagination
Pagination controls the number of elements or the range of elements returned in an API response. 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
|
$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 "$url/iaas/api/cloud-accounts?apiVersion=$api_version&"'$filter='"cloudAccountType%20eq%20'vsphere'"&$top=20&$skip=0 -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |
List the second set of 20 cloud accounts, or 21–40 |
curl -X GET "$url/iaas/api/cloud-accounts?apiVersion=$api_version&"'$filter='"cloudAccountType%20eq%20'vsphere'"&$top=20&$skip=20 -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |
List the third set of 20 cloud accounts, or 41–45 |
curl -X GET "$url/iaas/api/cloud-accounts?apiVersion=$api_version&"'$filter='"cloudAccountType%20eq%20'vsphere'"&$top=20&$skip=40 -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |