We are integrating a third-party API that does not support native pagination (page number, offset, or cursor-based pagination expected by Pega Constellation for infinite scrolling).
Instead, the API returns a continuation token (nextIdentifier) in the response, which must be supplied in the subsequent request to retrieve the next set of records.
Sample Response
JSON
{
“header”: {
“responseSource”: “SYSTEM_A”,
“responseTimestamp”: “2024-07-15T01:04:14.406Z”,
“correlationId”: “ABC123XYZ”,
“nextIdentifier”: “TOKEN_51”,
“recordCount”: 50,
“isLastPage”: false
},
“data”: {
“entries”: []
}
}
Show more lines
Sample Subsequent Request
JSON
{
“maxRecords”: 50,
“fromDate”: “2024-07-12T06:55:56.871Z”,
“toDate”: “2024-08-12T06:55:56.871Z”,
“startIdentifier”: “TOKEN_51”
}
Show more lines
Challenge
Pega Constellation’s infinite scrolling mechanism expects native pagination support, where the next page can be requested using a page number, offset, or a built-in pagination model.
In our case, the next set of data can only be retrieved by passing the nextIdentifier returned from the previous response. Therefore, we need a mechanism to persist and reuse this token across subsequent data page invocations.
Approaches Evaluated
We attempted to store the continuation token using the following approaches:
- Requestor-level editable Data Page
- Property on
pyWorkPage - Data Table / Data Record
However, none of these approaches have worked reliably due to Constellation’s architecture and the stateless manner in which data is retrieved for table pagination.
Question
Has anyone implemented infinite scrolling in Pega Constellation with an API that uses continuation-token-based pagination instead of native paging?
Specifically:
- How can the token returned from one response be persisted and supplied in the next data page call?
- Is there a recommended Constellation design pattern for handling token-based pagination?
- Are there any known workarounds or best practices for integrating such APIs with Constellation’s infinite scroll capability?
Any guidance or implementation examples would be greatly appreciated.