jans icon indicating copy to clipboard operation
jans copied to clipboard

feat (jans-config-api) : need to add pagination parameters in request and response of jans-config-api apis

Open duttarnab opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

The server-side pagination is the performance efficient technique when amount of data is large.

Describe the solution you'd like

In order to implement server-side pagination on applications (like admin-UI, jans-cli etc) using jans-config-api, we need to add the following pagination parameters in all GET apis (fetching multiple records).

In Request (query parameters to be added)

startIndex - This is the page index

limit - This is the number of rows that will be displayed per page.

Response (parameters to be added)

totalItems - This is the number of records/rows in the database.

Example

Request: curl -X GET -i 'http://<hostname>/jans-config-api/api/v1/openid/clients?startIndex=1&limit=10'

Response:

{
data: [{}, {}, {}, ...],
totalItems: 345
}

cc: @yuriyz @devrimyatar

duttarnab avatar Aug 17 '22 12:08 duttarnab

working on this

pujavs avatar Aug 24 '22 13:08 pujavs

Implemented the change for Attribute endpoint /jans-config-api/api/v1/attributes. Kindly review and confirm if good to be repeated to other endpoints

params:

  1. limit: Search size - max size of the results to return.
  2. pattern: Search pattern.
  3. string : Status of the attribute
  4. startIndex: The 1-based index of the first query result.
  5. sortBy: Attribute whose value will be used to order the returned response.
  6. sortOrder: Order in which the sortBy param is applied. Allowed values are "ascending" and "descending".

Response structure:

{ "totalItems": 0, "entriesCount": 0, "data": [ {} ]}

Testing:

Issue_2156_Pagination.xlsx

pujavs avatar Aug 29 '22 16:08 pujavs

Attributes changes for paginations has been verified and confirmed to be as expected. Re-opening as need to incorporate the pagination for other endpoints.

pujavs avatar Sep 09 '22 14:09 pujavs

Implemented the change via PR 2397 Modified endpoints:

  • Agama
  • Attribute
  • OpenId Client
  • CustomScript
  • Scope
  • UmaResource
  • UserMgmt

Response: Object class: https://github.com/JanssenProject/jans/blob/main/jans-orm/core/src/main/java/io/jans/orm/model/PagedResult.java

structure: { "entriesCount": 0, "entries": [ {} ], " "start": 0, "totalEntriesCount": 0 }

Test reports src.test.resources.feature.config.scripts.custom.generic.custom.pdf src.test.resources.feature.attribute.attributes.pdf src.test.resources.feature.agama.agama.pdf src.test.resources.feature.mgt.user.user.pdf src.test.resources.feature.uma.scopes.umascopes.pdf src.test.resources.feature.uma.resource.resources.pdf src.test.resources.feature.openid.scopes.scopes.pdf src.test.resources.feature.openid.clients.clients.pdf src.test.resources.feature.config.scripts.custom.persons.person-scripts.pdf

pujavs avatar Sep 15 '22 19:09 pujavs