Web Service Paging steps not working as expected

Hello Everyone,

I am trying to define paging steps for a web service connector.

The paging steps for the user endpoint is as follows:
The endpoint is defined with a query parameter range followed by two numbers seperated by the character “-” EX: /users?range=0-50 the first number represents the Offset (which we will be incrementing to return next results) and the second number represents the number of object returned.
Therefore if we want to display the next results in the example provided we would use /users?range=50-50

I tried to implement this logic in IDN with the following code

$sysparm_limit$ = 50
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$
TERMINATE_IF $NO_RECORDS$ == TRUE
$offset$ = $offset$ + $sysparm_limit$
$endpoint.fullUrl$ = $application.baseUrl$ + "/users?range=" + $offset$ + "-50"

But in this did not work
I tried to change the logic by putting the whole offset value in one variable

$sysparm_limit$ = 50
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$
TERMINATE_IF $NO_RECORDS$ == TRUE
$offset$ = $offset$ + $sysparm_limit$
$offsetString$ = $offset$ +"-50"
$endpoint.fullUrl$ = $application.baseUrl$ + "/users?range=" + $offsetString$

But for this logic the variable $offsetString$ was defined as 0
I even tried to user the HTML encoding - instead of the - but it did not solve my issue.

Has anyone encountered a similar issue? and if yes can someone guide me to a solution?

Best regards

Is the string passed for range always x-50? Or should it be x-y where y = x+50?
In such case you can try this

$sysparm_limit$ = 50
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$
TERMINATE_IF $NO_RECORDS$ == TRUE
$offset$ = $offset$ + $sysparm_limit$
$offsety$ = $offset$ + $sysparm_limit$
$offsetString$ = $offset$ +"-"+$offsety$
$endpoint.fullUrl$ = $application.baseUrl$ + "/users?range=" + $offsetString$

the string passed is always x-50. The 50 represents the number of objects returned regardless of the offset.
0-50 : will return Objects with offset 0 to offset 49
50-50: will return Objects with offset 50 to 99 etc.

1 Like

I was able to solve this issue simply by seperating the “-” from the “50” in my paging steps:

$sysparm_limit$ = 50
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$
TERMINATE_IF $NO_RECORDS$ == TRUE
$offset$ = $offset$ + $sysparm_limit$
$endpoint.fullUrl$ = $application.baseUrl$ + "/directory/users?range=" + $offset$ + "-" +"50"
3 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.