Does anyone know why pageNumber is being ignored in my Java SDK call? I am using com.genesiscloud.analytics.reporting.api.ReportingApi with pageSize set to 50. As the docs state, “detail queries utilize token-based pagination,” so I expected offset pagination to work for this endpoint. Instead, I get a 400 Bad Request. Here is the code snippet: ReportingQuery query = new ReportingQuery(); query.setPageSize(50);. How do I correctly implement paging here?
I think the Analytics API strictly enforces token-based pagination for detail queries, so sending pageNumber triggers a validation error.
400 Bad Request: Invalid parameter ‘pageNumber’ for detail query type
Switch to the Python SDK to handle the nextPageToken loop automatically, as shown below.
from purecloudplatformclientv2 import AnalyticsApi, ReportingApi
api = AnalyticsApi()
# Use get_analytics_reportings_detail with nextPageToken instead of pageNumber
resp = api.get_analytics_reportings_detail(
report_id="your-report-id",
body=ReportingQuery(page_size=50),
next_page_token=None # SDK handles this loop internally
)
Ah, yeah, this is a known issue. the suggestion above is correct. in my react desktop builds, i avoid pageNumber entirely. use nextPageToken instead. here is the correct payload structure for the initial request:
{
"pageSize": 50,
"nextPageToken": null
}
subsequent calls require the token from the response.
Yep, this is a known issue.
400 Bad Request: Invalid parameter ‘pageNumber’ for detail query type
You must switch tonextPageTokenin theReportingQuerybuilder since detail queries enforce token-based pagination, as shown in the loop below.
ReportingQuery query = new ReportingQuery();
query.setPageSize(50);
query.setNextPageToken(null); // Initial request
// In loop: query.setNextPageToken(response.getNextPageToken());
have you tried dropping pageNumber entirely? detail queries enforce token pagination. the sdk throws a 400 if you send it. use nextPageToken in the ReportingQuery builder instead.
ReportingQuery q = new ReportingQuery();
q.setPageSize(50);
q.setNextPageToken(null); // init
// loop: q.setNextPageToken(resp.getNextPageToken())