Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/12/2022 01:16 PM
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
Solved! Go to Solution.
04/12/2022 02:47 PM
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
04/12/2022 02:47 PM
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.
04/12/2022 02:47 PM