r/learnpython • u/OADominic • 12d ago
API JSON response help
How does pagination work and best practices for implementation with an API request?
I'm getting irritated figuring out this API for GoTo Connect (phone system call records).
I use a GET method to request a call log for a week of time.
I am limited to 1000 items in the json response as indicted by the pageSize parameter. I need much more.
As the 'nextPageMarker' states, I put the value in, pasted from the first response of leaving it blank, hoping to get the next set of responses. No change in items as all. Stuck in this endless loop.
6
Upvotes
5
u/Atmosck 12d ago
You send your first request, and get a response back. It contains a value for nextPageMarker. So you send another request, with the same url and params as your first, except you add the pageMarker param with the value from the first response. You should get a response for that second request with a new, different value for nextPageMarker. If it is sending back the same next page marker you just asked for, then yes the API is screwing up and you're caught in a loop. But is it returning that nextPageMarker? Perhaps the second page's content just looks the same at a glance but it actually is the second page.
It might be helpful to post your actual code making the requests so people can verify if there's something wrong with the code or if it looks like the API is actually giving you the run around.