Hey everyone,
I’m trying to pull detailed interaction data for our WFM adherence reports using the Analytics API. The goal is to get every single interaction from the last 24 hours so we can audit wrap-up times. I’ve been using the Python SDK, but something weird is happening with the paging logic.
Here’s the basic loop I wrote to fetch the data:
from genesyscloud import analytics_api_client
analytics = analytics_api_client.AnalyticsApi()
start_time = "2023-10-25T12:00:00.000Z"
end_time = "2023-10-26T12:00:00.000Z"
page_number = 1
page_size = 100
while True:
body = analytics.get_analytics_interactions_get(
start_time=start_time,
end_time=end_time,
page_size=page_size,
page_number=page_number
)
print(f"Fetched page {page_number}, got {len(body.entities)} entities")
# Save data...
# Check if there are more pages
if body.page_count <= page_number:
break
page_number += 1
The first page comes back fine with 100 entities. The page_count in the response says 5. So the loop runs for pages 1, 2, 3, 4, and 5. But here’s the kicker: page 2 returns empty entities. Page 3 has data, page 4 has data, and page 5 is empty again.
I’m getting a 200 OK for all requests, so no errors there. It feels like the pageNumber parameter isn’t being respected correctly, or maybe I’m misunderstanding how pageCount works. Is pageCount the total number of pages available, or is it a limit on the current batch?
I’ve checked the docs, and it says pageSize defaults to 25, max 1000. I’m using 100. I thought pageNumber was just a 1-based index. But the gaps in data suggest otherwise.
We’re in US/Central, so timezone offsets shouldn’t be an issue since I’m passing UTC strings.
Has anyone seen this behavior before? Should I be using a cursor-based approach instead? Or is there a specific header I need to send?
Thanks for any pointers.