Issues with WS Pagination

Hello all,

I have a new integration that has paginated results, but unfortunately no total count or next page attribute, or anything to indicate there are more results. I have created the following logic to try to brute force the aggregation to approach the total number of records, but it always returns 275.

TERMINATE_IF $RECORDS_COUNT$ == 13600
$newOffset$ = $offset$ + 100
$endpoint.fullUrl$ = $application.baseUrl$ + “/rest/api/2/users?maxResults=100&startAt=” + $newOffset$

I would like to leverage NO_RECORDS == TRUE, but I cannot get the aggregation above this number even with this hard coded example. Any ideas?

@joe_gaileyiii, Does you API endpoint support querying based on “maxResults” or “startAt” parameters? Because if it doesn’t, I don’t see a reason why this would work. Ideally, the target system needs to allow querying on the API endpoint based on query params like ‘count’, ‘nextpage’, ‘index’, ‘maxresults’ etc for it to be configured on ISC pagination config.

You could try this
$sysparm_limit$ = 100
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$
$newOffset$ = $newOffset$ + $sysparm_limit$
$endpoint.fullUrl$ = $application.baseUrl$ + “/rest/api/2/users?maxResults=100&startAt=” + $newOffset$

here is reference for pagination - Paging Based on Limit-Offset

If pagination tab is not working for you, then other way to deal this is using before and after operation rule if it is VA based webservice connector - Before and After Operation Rules Configuration

@joe_gaileyiii
you can try below logic:

“TERMINATE_IF $response.$Resources[*].id$ == NULL
$startIndex$ = $response.startIndex$ + $response.itemsPerPage$
$endpoint.fullUrl$ = "$application.baseUrl$ + “/rest/api/2/users?maxResults=100&startAt=” + $startIndex$",

change this to
$newOffset$ = $startAt$ + 100
and try

If my memory serves right, you need to refer to the query parameter from previous page context URL. You are using $offset$, but there is no such parameter in the URL

This worked for me, thank you!

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