Hey team, looking for the best way to handle pagination when pulling a massive dump of conversation details via the /api/v2/analytics/conversations/details/query endpoint. I’ve got a Python script that needs to grab every single interaction from the last 90 days, and the default page size of 1000 means I’m hitting the limit way too fast. The docs mention a cursor parameter for the response, but I’m a bit confused on how to chain it properly. My current approach is just incrementing the page number in the query string, but I noticed the response payload includes a nextPage URL and a cursor value. Which one should I be using? Is the cursor meant to replace the page number entirely, or do I need to keep sending the original query parameters along with the new cursor? Here’s the snippet I’m working with:
response = session.get(
'https://{{myorg}}.mygenesys.cloud/api/v2/anversations/details/query',
headers={'Authorization': f'Bearer {token}'},
params={'dateFrom': '2023-10-01', 'dateTo': '2023-12-01', 'pageSize': 1000}
)
When I look at the JSON response, I see the nextPage field populated, but trying to just hit that URL directly gives me a 401 error because the token expires or the session changes. I’ve tried appending &cursor={{cursor_value}} to the original endpoint URL in the next request, but it feels like I’m missing something about how the state is maintained. Does the API require me to resend all the original query filters every time I use the cursor, or is the cursor supposed to encapsulate all that context? I don’t want to end up with duplicate records or miss a chunk of data if the logic is off. Also, if I’m using the Python SDK, is there a built-in method that handles this automatically, or do I have to manually parse the cursor and loop until it’s null? The SDK docs are a bit light on specific examples for this endpoint.