Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/10/2024 08:57 AM
Hi,
We have a requirement of pagination and I have gone through the documentation of pagination. I feel that this is possible, However, I would like to check with you confirming that this is possible.
We have the API response as below:
GET https://xxxxx/v1/rlasass_compounds/<id>/rls
RESPONSE 1:
{
"next_page": "bqjobid_1-continuationid_1",
"items": [
{
"user_id": "string",
"entitlement": "string",
"created_at": "string"
},
...
]
}
GET https://xxxx/v1/rls_compounds/<id>/rlasass?next_page=bqjobid_1-continuationid_1
RESPONSE 2:
{
"next_page": "bqjobid_1-continuationid_2",
"items": [
{
"user_id": "string",
"entitlement": "string",
"created_at": "string"
}
...
]
}
GET https://xxxxxxxx/v1/rasas_compounds/<id>/rasas?next_page=bqjobid_1-continuationid_2
RESPONSE 3:
{
"next_page": "bqjobid_1-continuationid_3",
"items": [
{
"user_id": "string",
"entitlement": "string",
"created_at": "string"
},
...
]
}
Logic is that we need to read the value of "next_page". If it is not null, then read from the next page "GET https://xxxxxxxx/v1/rasas_compounds/<id>/rasas?next_page=bqjobid_1-continuationid_1" and so on... If this value is null, then there are no next pages and we can stop the iteration.
Based on the documentation provided above, I feel that this is achievable by following the syntax provided in the documentation. If you could provide the confirmation, as well, it would be helpful.
Thanks!
Solved! Go to Solution.
09/10/2024 09:01 AM - edited 09/10/2024 09:01 AM
Sample update as per you need
"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.completeResponseMap?.nextPageToken==null?null:'
https://admin.googleapis.com/admin/directory/v1/groups/'+id+'/members?pageToken='+response.completeResponseMap.nextPageToken}"
}
}
09/10/2024 08:25 PM - edited 09/10/2024 08:29 PM
@Bharadwaj
Try the below pagination
{
"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.next_page == null ? null : 'https://xxxxxxxx/v1/rasas_compounds/' + id + '/rasas?next_page=' + response.next_page}"
}
}
}
{
"pagination": {
"nextUrl": {
"nextUrlPath": "${(response?.completeResponseMap?.next_page == null) ? null : 'https://xxxxxxxx/v1/rls_compounds/<id>/rlasass?next_page=' + response?.completeResponseMap?.next_page}"
}
}
}
09/10/2024 10:16 PM
Hi @Bharadwaj , we are using this for an application which gives similar result
{
"pagination": {
"nextUrl": {
"nextUrlPath": "${(response?.completeResponseMap?.next_page == null) ? '' : 'https://xxxxxxxx/v1/rls_compounds/<id>/rlasass?next_page=' + response?.completeResponseMap?.next_page}"
}
}
}