Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Pagination for REST connector with multiple links and URL manipulation

Kshah
New Contributor II
New Contributor II

Hello,

Below is our response from an API call with Infor. Note, there are no 'links' in the headers of the response:

Kshah_0-1702420014527.png

I am trying to use the link found in the "rel": "next" section. I am also trying to make some manipulations to the reference URL so that we can actually use the URL to return results. Below is the pagination I am trying:

"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.completeResponseMap?._links.href[1]==''?null:'https://TestSite.com/path1/path2/path3/Employee'+response?.completeResponseMap?._links.href[1]}"
}
}
 
Trying to add the response URL onto the end of the above URL. The error message keeps pointing at a "Syntax error at index 1". Please advise
 
Thank You
4 REPLIES 4

rushikeshvartak
All-Star
All-Star

Refer example 1 from https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

example 1 does not have the issue of each link (next, prev, self) being called as "href". We are trying to only use HREF where REL = NEXT. 

Rajesh-R
Saviynt Employee
Saviynt Employee

@Kshah  - Could you try the following:

"pagination": {
"nextUrl": {
"nextUrlPath": "${urlNextPath=''; ArrayList arr = response?.completeResponseMap?._links; if(arr.size()>0){arr.eachWithIndex{ val, idx -> if(val.rel?.equals('next')){ urlPathNext=val.href;}}} return 'https://TestSite.com/path1/path2/path3/Employee'+urlPathNext;}
}
}

Thanks
Rajesh Ramalingam
Saviynt India

Kshah
New Contributor II
New Contributor II

Hi Rajesh,

Trying that pagination returns same error message on syntax:

Got null response statusCode with erroMsg - [error:Error Illegal character in path at index 1: ${urlNextPath=''; ArrayList arr = response?.completeResponseMap?._links; if(arr.size()>0){arr.eachWithIndex{ val, idx -> if(val.rel?.equals('next')){ urlPathNext=val.href;}}} return 'BaseURL'+urlPathNext;}]

 

Any suggestion?