How does the paging object actually work for /api/v2/analytics/queues/schedules? I’m trying to grab all schedule data but the response keeps cutting off at 250 items, even though I set pageSize to 1000.
- Using Python
genesyscloud SDK
paging={'pageSize': 1000, 'pageNumber': 1}
pageCount in response is always 4
The docs say pageNumber is 1-based, but changing it to 2 just returns the same first batch. Am I missing a specific parameter to fetch subsequent pages?
The SDK handles pagination automatically if you just ask for it. You don’t need to manually loop through page numbers unless you’re doing raw HTTP calls. The get_analytics_queues_schedules method returns a generator or an iterable object depending on your SDK version, but usually, you just want the full list.
Try using the async_get variant or simply iterating over the pages if you’re stuck on the sync method. Here’s how I usually grab the whole dataset in Python without worrying about the 250-item cap:
from genesyscloud.analytics import AnalyticsApi
analytics_api = platform_client.analytics_api
# This returns a generator yielding each page
pages = analytics_api.get_analytics_queues_schedules(
date_from="2023-10-01",
date_to="2023-10-07",
queue_ids=["your-queue-id"],
paging={'pageSize': 250} # Max is often 250 regardless
)
all_schedules = []
for page in pages:
if page.entity:
all_schedules.extend(page.entity)
The pageCount being 4 just means there are 4 pages of results at the max size. If you set pageSize to 1000 and the API caps it at 250, it’ll still return 4 pages. Just iterate. The docs are terrible about this part. I spent half a day debugging this exact issue last week.