Hey everyone,
I’m trying to pull detailed conversation data for our WFM adherence reports. We need to query the /api/v2/analytics/conversations/details/query endpoint to get interaction IDs and handle times. The goal is to aggregate this into a CSV for our scheduling team to review agent performance.
The documentation mentions using a cursor parameter for pagination, but I’ve seen older examples using page and pageSize. I’m currently using the Python SDK (genesyscloud_platformclient). Here’s how I’m setting up the initial request:
from genesyscloud_platformclient.rest import ApiException
from genesyscloud_platformclient.api.analytics_api import AnalyticsApi
analytics = AnalyticsApi()
request_body = {
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-01T23:59:59.999Z",
"groupBy": "interaction",
"view": "default",
"size": 100
}
try:
response = analytics.post_analytics_conversations_details_query(body=request_body)
print(f"Got {len(response.conversations)} conversations")
except ApiException as e:
print(f"Exception: {e}")
The first call works fine and returns 100 records. The response object has a next_page field (or similar, I’m checking the actual response now). If next_page is present, how do I pass it back? Do I just put the cursor string into the body of the next request? Or do I use a different method call?
Also, if I use pageSize instead of size, does that change anything? I’m worried about hitting rate limits if I loop through too fast. We usually have about 5k calls a day, so that’s 50 requests. Is that safe?
I tried setting page=2 in the body for the second request, but I got a 400 Bad Request error saying the body format was invalid. It seems like page isn’t supported for this specific endpoint anymore.
Can someone show me a working loop for fetching all pages using the cursor approach? I’m new to this API style and want to make sure I’m not doing it wrong. Thanks.