We have a requirement which requires us to create a custom plugin and expose APIs needed for third party. But the challenge is we need the REST APIs, which will be exposed by developing custom plugins, to support Pagination?
We have developed a basic plugin in past but it did not require Pagination earlier. And I didn’t find any docs in community as well regarding the same.
Any help will be appreciated or if anyone has already worked on such requirement I request to share the code here.
@aakashpandita Yes, custom REST APIs exposed through a plugin can support pagination. There is no plugin-specific pagination framework in IIQ; you typically implement it yourself using query parameters such as offset/limit or page/pageSize.
Hello Aakash. As @vikaspawar0303 suggested, I would use QueryOptions with setFirstRow() and setResultLimit() and also return the total count so the caller can handle pagination.
SailPoint uses the same pattern in its Java DataSource example: a base QueryOptions for filters, a copied query for paging, addOrdering() for ordering, and countObjects() for the total. Reports DataSource Example
QueryOptions baseQo = new QueryOptions();
// add filters
int total = context.countObjects(Identity.class, baseQo);
QueryOptions pageQo = new QueryOptions(baseQo);
pageQo.addOrdering("id", true);
pageQo.setFirstRow(offset);
pageQo.setResultLimit(limit);
Iterator<Object[]> rows = context.search(
Identity.class,
pageQo,
Arrays.asList("id", "name", "displayName"));
Here, context is your SailPointContext.
The REST response can return the page information along with the results: