Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Pagination based on the response.

Bharadwaj
Regular Contributor
Regular Contributor

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!

3 REPLIES 3

rushikeshvartak
All-Star
All-Star

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}"
          }
        }

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

stalluri
Valued Contributor
Valued Contributor

@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}"
    }
  }
}

Best Regards,
Sam Talluri
If you find this a helpful response, kindly consider selecting Accept As Solution and clicking on the kudos button.

NM
Honored Contributor II
Honored Contributor II

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}"

    }

  }

}