How to provide Pagination support in Custom Plugin?

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.

Thank you in advance.

@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.

Recommended approach:

  • Accept parameters: limit, offset (or page, size).
  • Query IIQ objects using QueryOptions.
  • Apply setResultLimit() and paging logic.
  • Return metadata such as:
QueryOptions qo = new QueryOptions();

qo.setResultLimit(limit);

qo.setFirstRow(offset);

List<Identity> identities =

 context.getObjects(Identity.class, qo);

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:

{
  "offset": 0,
  "limit": 100,
  "total": 1250,
  "items": [ ... ]
}

For the custom REST resource, extend BasePluginResource and expose offset / limit or page / pageSize as request parameters. Plugin Java Classes