Pagination WS: Replace character

Hello Experts,

We have a WS connector that requires pagination. To do that, we used the pagination option as follow:

TERMINATE_IF $response.nextpagetoken$ == NULL
$endpoint.fullUrl$ = $application.baseUrl$ +“/api/x/users/v2/employees?status=inactive&nextpagetoken=”+ $response.nextpagetoken$

The issue now is that we detected some nextpagetoken with an special character “/” which is causing an error due to Java.

NextpageToken generated: AOOpJ5Qk0MjYYi3KMM/moVuJzU%20SsSGsU3NaCRMEQew=
NextpageToken procesed by IDN: AOOpJ5Qk0MjYYi3KMM /moVuJzU%20SsSGsU3NaCRMEQew=

The special character is being scaped / instead of / so it cannot be converted to the proper ASCI value. As alternative, I thought that maybe we could convert the value using the pagination:

TERMINATE_IF $response.nextpagetoken$ == NULL
$newToken$=$response.nextpagetoken$.replace(“/”, “%2F”)
$endpoint.fullUrl$ = $application.baseUrl$ +“/api/x/users/v2/employees?status=inactive&nextpagetoken=”+ $newToken$

But we are getting the error: sailpoint.connector.ConnectorException: Url: null, Message: 0 : sailpoint.connector.ConnectorException: Final URL can not be null, HTTP Error Code: 0

Any idea?

Thanks in advance.
B.

Hi Beatriz,

I don’t think the templating engine supports arbitrary java code. Is there some documentation that suggests you can use the .replace() function? That may be causing the issue if the templating engine fails on that line and never assigns $endpoint.fullUrl$.

Hello Colin, actually I didn’t find anything about this function, so it make sense that the root of the error was the replace. There is another suggested way of modifying this token?

Thanks

A before operation rule seems most appropriate here. You can find the guide here.