We are pulling interaction data using the Analytics API in our .NET backend. The goal is to fetch all records for a specific date range. I am using the /api/v2/analytics/interactions/summary endpoint. The initial request returns data and a paging object. I see pageSize is 50 and pageCount is 10. I expect to get 500 records total.
My loop looks like this. I increment pageNumber from 1 to 10.
var client = new AnalyticsApi(...);
int total = 0;
for (int i = 1; i <= 10; i++) {
var resp = await client.GetInteractionsSummaryAsync(..., pageNumber: i);
total += resp.Entities.Count;
}
The problem is that after page 3 or 4, the Entities array is empty. The HTTP status is still 200. No error thrown. The pageCount in the response header stays at 10 but the body has no entities. I checked the docs and pageNumber should work. I tried using pageSize of 1000 but the loop still fails early. What is the correct way to paginate through this endpoint without missing data?