jans
jans copied to clipboard
feat (jans-config-api) : need to add pagination parameters in request and response of jans-config-api apis
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
working on this
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:
-
limit
: Search size - max size of the results to return. -
pattern
: Search pattern. -
string
: Status of the attribute -
startIndex
: The 1-based index of the first query result. -
sortBy
: Attribute whose value will be used to order the returned response. -
sortOrder
: Order in which the sortBy param is applied. Allowed values are "ascending" and "descending".
Response structure:
{ "totalItems": 0, "entriesCount": 0, "data": [ {} ]}
Testing:
Attributes changes for paginations has been verified and confirmed to be as expected. Re-opening as need to incorporate the pagination for other endpoints.
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