Page through long lists with page_size and a continuation token.
List endpoints that can return many records, such as Get Assets, return them in pages. You set the page size, and a continuation token takes you to the next page.
Request a page
Add page_size to the query string:
curl --request GET 'https://talk.perspio.io/assets/v3/?page_size=100' \
--header 'Authorization: Bearer {access_token}' \
--header 'tid: {tid}' \
--header 'Ocp-Apim-Subscription-Key: {subscription_key}'The response headers describe the page:
| Header | Meaning |
|---|---|
ResultCount | Records in this page |
TotalCount | Records that match the request across all pages |
ContinuationToken | Present when there are more pages. Send it back to get the next page |
Get the next page
Repeat the same request with the token in a ContinuationToken request header. When a response comes back without a ContinuationToken, you have every record.
$headers = @{
Authorization = "Bearer $accessToken"
tid = '{tid}'
'Ocp-Apim-Subscription-Key' = '{subscription_key}'
}
$all = @()
do {
$response = Invoke-WebRequest -Uri 'https://talk.perspio.io/assets/v3/?page_size=100' -Headers $headers
$all += $response.Content | ConvertFrom-Json
$token = $response.Headers['ContinuationToken'] | Select-Object -First 1
$headers['ContinuationToken'] = $token
} while ($token)import requests
headers = {
"Authorization": f"Bearer {access_token}",
"tid": "{tid}",
"Ocp-Apim-Subscription-Key": "{subscription_key}",
}
records = []
while True:
response = requests.get(
"https://talk.perspio.io/assets/v3/", params={"page_size": 100}, headers=headers, timeout=60
)
response.raise_for_status()
records.extend(response.json())
token = response.headers.get("ContinuationToken")
if not token:
break
headers["ContinuationToken"] = token
Check each endpointEndpoints that page list
page_sizeandContinuationTokenon their reference page. A few use other parameters instead, such astakeorlimit. The endpoint page shows which.

