Hey everyone,
I’m trying to figure out if I’m misunderstanding how the paging object works in the Genesys Analytics API. The goal is to pull a full set of interaction data for our WFM adherence reports. We need every record from the last 24 hours to ensure our service level metrics are accurate.
I’ve written a simple Python script using the genesyscloud SDK. It looks like this:
from genesyscloud import analytics_api
analytics = analytics_api.AnalyticsApi(api_client)
# Initial request
response = analytics.get_analytics_interactions_get(
query_params={
'pageSize': 250,
'pageNumber': 1,
'interval': '2023-10-27T00:00:00.000Z/2023-10-28T00:00:00.000Z',
'view': 'default'
}
)
total_pages = response.paging.pageCount
print(f"Total pages reported: {total_pages}")
for i in range(2, total_pages + 1):
next_response = analytics.get_analytics_interactions_get(
query_params={
'pageSize': 250,
'pageNumber': i,
'interval': '2023-10-27T00:00:00.000Z/2023-10-28T00:00:00.000Z',
'view': 'default'
}
)
# process data...
The issue is that pageCount returns 10, which makes sense given the volume. Page 1 returns 250 records. Page 2 returns 250 records. But when the loop hits page 3, the entities array is empty. The pageCount in the response for page 3 is still 10, but there’s no data.
I’ve tried switching to pageSize of 100, but it stops at page 2 again. I thought pageCount was a hard limit of total pages available. Is there a max row limit per query that overrides the page count? Or am I missing a parameter in the query string?
The API docs say “pageCount: The total number of pages available”. It feels like the server is cutting me off early. I don’t want to miss data for our adherence audit. What’s the correct way to loop through this without hitting a wall?