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

REST Connector - Query on Pagination

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 11 2021 at 23:17 UTC

Hello folks,


We are implementing account and entitlement import and looks like we will have to implement pagination for the same.

We tried the below code as per the REST connector guide (https://saviynt.freshdesk.com/support/solutions/articles/43000521736-rest-connector-guide section ) and it’s not working:


"pagination": {

  "nextUrl": {

  "nextUrlPath": "${response?.completeResponseMap?.@odata.nextLink==null?null:response.completeResponseMap.@odata.next..."

    ${response.completeResponseMap.bookmark}"

  }

}

 

I just noticed one thing in the above code, the ? seems a little odd to me. Looks like they are not required, but not sure thought. Any idea if the below code will work, where I have removed ?:

"pagination": {

  "nextUrl": {

  "nextUrlPath": "${response.completeResponseMap.@odata.nextLink==null?null:response.completeResponseMap.@odata.nextLi..."

  }

}


Do you have sample that has pagination implemented in it. Any help is greatly appreciated.

 

Tks

Sunil

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
3 REPLIES 3

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 12 2021 at 04:54 UTC

Hi Sunil,

The question mark is a 'Null Safe' Operator widely used in Groovy as a best practice. Typically when you have a reference to an object you might need to verify that it is not null before accessing methods or properties of the object. To avoid this, the safe navigation operator (?) will simply return null instead of throwing an exception (Null Pointer Exception).

In the pagination example as well, the response is the object which is initialized to store the API response, so when the pagination eventually does not have a response, its best practice to use it for a safe exit.


Adding a few links to explanations on the operator :

https://www.danvega.dev/blog/2013/08/20/groovys-null-safe-operator/
https://groovy-lang.org/operators.html

Regards,

Sahaj

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on October 12 2021 at 16:22 UTC

Thanks Sahaj for the details on why we should be using the ? operator.

In our case, the pagination is not working. We dont see the 2nd web API call happening in the import for pagination.


Can you provide any sample for the pagination import? Tejsvi is also looking into this issue.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on November 17 2021 at 10:07 UTC

Hello Sunil,
Were you able to make this work?
This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.