How to do paging in web service connector

Which IIQ version are you inquiring about?

Version 8.3

Share all details related to your problem, including any error messages you may have received.

At the time of aggregation operation I am using below URL:
/v1/Users?count=100&startIndex=101

An in pagination I am using below script:

TERMINATE_IF $response.itemsPerPage$ == 0
$offset$ = $offset$ + $limit$
$endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ +“?startIndex=”+ $offset$

This script is not ending it is continuously in loop. Forcefully I am terminating it, and below is my response coming from postman:

{
“totalResults”: 170,
“startIndex”: 201,
“itemsPerPage”: 100,
“Resources”:
}

I want to terminate task when resources does not contain any value. Please help me out of this.

check below sample if this helps

$limit$ = 100
TERMINATE_IF $RECORDS_COUNT$ < $limit$
$offset$ = $offset$ + $limit$
$endpoint.fullUrl$ = $application.baseUrl$ + "/api/organizations/abcd/vishal?limit=100&offset=" + $offset$"

The documentation is very good for the pagination of the Web Services Connector:
https://documentation.sailpoint.com/connectors/identityiq8_3/webservices/help/integrating_webservices/pagination.html

In the information you provided:
Please remove the &startIndex=101 from the URL. So the first call will be starting from 0 and for the next page startindex will be added.
Also replace the ? with a & in $endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ +“?startIndex=”+ $offset$ ( There is already a ? in the relative URL :slight_smile:

So:
Relative URL = v1/Users?count=100
Paging step:

$offset$ = $offset$ + $limit$
TERMINATE_IF $response.totalResults$ < $offset$
$endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ +“&startIndex=”+ $offset$

– Remold


Hi @vishal_kejriwal1,
Thanks for your script, I have used your script but it is not working so I have updated some changes in screenshot but It is also not working, can you please provide me some other solution.

Hi Aman. change the limit in the 2nd line replace it with offset and see.

1 Like

Hi @MuhammadMustafa, Thanks for quick response.
I have done changes as per your suggestion, now it is giving 122 record but it having 172 record below is my screenshot for sailpoint and postman.
MicrosoftTeams-image (1)

Hello Aman.

I think that in your paging steps the “TERMINATE_IF” line should be above your $offset$ addition line, or else the condition will be satisfied before you make all your paging calls.

Hi @Nadim,

TERMINATE_IF $response.totalResults$ < $offset$
$offset$ = $offset$ + $limit$
$endpoint.fullUrl$ = $application.baseUrl$ + “/v1/Users?startIndex=” + $offset$ +“&count=100”

I have changed the code as per your suggestion but still It is fetching 122 records

Hi @amanKsingh I can join a call with you after the Developer Day activity/sessions and troubleshoot it with you (if you want).