Genesys Cloud Analytics API: Handling pageSize and pageCount in paging object for Terraform data source

building a custom Terraform data source that needs to fetch conversation analytics from Genesys Cloud. The endpoint in question is GET /api/v2/analytics/conversations/details/query.

The documentation states that the response includes a paging object with pageSize, pageNumber, and pageCount. We are trying to iterate through all pages to ensure we capture the complete dataset for a given date range. However, we are seeing inconsistent behavior when setting the pageSize parameter.

Here is the relevant portion of our code:

response = requests.get(
 f"{base_url}/api/v2/analytics/conversations/details/query",
 headers=headers,
 params={
 "pageSize": 100,
 "pageNumber": 1
 }
)

When we set pageSize to 100, the response indicates a pageCount of 5, but only the first page returns data. Subsequent requests with pageNumber 2 through 5 return empty arrays. We have verified that the data exists by manually querying the API with different page sizes.

We suspect there might be an issue with how the paging object is being handled in our code. We have tried adjusting the pageSize to 50 and 200, but the problem persists. Has anyone encountered similar issues with the paging object in the Analytics API? We are looking for best practices on how to correctly handle pagination in this context.