We’re building a script to pull conversation details for our Pacific team’s adherence tracking. The goal is to get every conversation from the last 24 hours. I’m using the Python SDK analytics_api module.
The first call works fine. I get back 250 records and a nextUri. But when I follow that link, the SDK seems to reset the dateFrom parameter or ignore the cursor entirely. It just returns the first page again. I’ve tried passing the nextUri directly as the URL and also extracting the query params manually.
Here is the snippet:
from genesyscloud import analytics_api
api = analytics_api.AnalyticsApi(client)
body = {
"dateFrom": "2023-10-27T00:00:00.000Z",
"dateTo": "2023-10-27T23:59:59.999Z",
"groupBy": ["conversationId"],
"size": 250
}
response = api.post_analytics_conversations_details_query(body=body)
# Trying to paginate
while response.next_uri:
print(f"Fetching next page: {response.next_uri}")
# This feels wrong but the docs aren't clear on SDK usage
response = api.get_analytics_conversations_details_query_by_id(
query_id=response.next_uri.split("/")[-1] # Hacky attempt
)
The get_analytics_conversations_details_query_by_id method expects a queryId, not a full URI. Passing the raw nextUri to post_analytics_conversations_details_query again throws a 400 error because dateFrom is already in the body.
How do we handle cursor pagination properly in the Python SDK for this endpoint? The standard page-based approach doesn’t seem to apply here.