# How to do paging in web service connector

**URL:** <https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944>\
**Category:** IIQ Discussion and Questions\
**Tags:** webservice-connector, identityiq\
**Created:** [April 3, 2024, 12:16pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944 "2024-04-03T12:16:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanKsingh](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amanKsingh](https://developer.sailpoint.com/discuss/u/amanKsingh)\
**Post date:** [April 3, 2024, 12:16pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/1 "2024-04-03T12:16:20Z")

</div>

### 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.

---

<div class="post-metadata">

**Author:** ![vishal\_kejriwal1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vishal_kejriwal1/32/10904_2.png) [@vishal\_kejriwal1](https://developer.sailpoint.com/discuss/u/vishal_kejriwal1)\
**Post date:** [April 3, 2024, 2:11pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/2 "2024-04-03T14:11:15Z")

</div>

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$"

---

<div class="post-metadata">

**Author:** ![Remold](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/remold/32/3275_2.png) [@Remold](https://developer.sailpoint.com/discuss/u/Remold)\
**Post date:** [April 3, 2024, 4:37pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/3 "2024-04-03T16:37:57Z")

</div>

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](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 🙂

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

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

```

– Remold

---

<div class="post-metadata">

**Author:** ![amanKsingh](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amanKsingh](https://developer.sailpoint.com/discuss/u/amanKsingh)\
**Post date:** [April 8, 2024, 8:32am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/4 "2024-04-08T08:32:54Z")

</div>

![image](https://global.discourse-cdn.com/sailpoint/original/2X/7/7e4cd5ad92fc54c419dec715c166e99cb2fb56b4.png)  
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.

---

<div class="post-metadata">

**Author:** ![Muhammad\_Mustafa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/muhammad_mustafa/32/27611_2.png) [@Muhammad\_Mustafa](https://developer.sailpoint.com/discuss/u/Muhammad_Mustafa)\
**Post date:** [April 8, 2024, 9:19am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/5 "2024-04-08T09:19:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amanKsingh](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amanKsingh](https://developer.sailpoint.com/discuss/u/amanKsingh)\
**Post date:** [April 9, 2024, 6:39am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/6 "2024-04-09T06:39:06Z")

</div>

Hi @Muhammad_Mustafa, 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)](https://global.discourse-cdn.com/sailpoint/original/2X/5/54542123431fb8bb237ec4f9f4d6ac00969fee77.png)

 ![MicrosoftTeams-image](https://global.discourse-cdn.com/sailpoint/original/2X/5/5e772ae27ecde987297a48c507fefd39b449d41d.png)

---

<div class="post-metadata">

**Author:** ![Nadim](https://avatars.discourse-cdn.com/v4/letter/n/9dc877/32.png) [@Nadim](https://developer.sailpoint.com/discuss/u/Nadim)\
**Post date:** [April 9, 2024, 7:14am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/7 "2024-04-09T07:14:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amanKsingh](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amanKsingh](https://developer.sailpoint.com/discuss/u/amanKsingh)\
**Post date:** [April 9, 2024, 7:39am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/8 "2024-04-09T07:39:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Muhammad\_Mustafa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/muhammad_mustafa/32/27611_2.png) [@Muhammad\_Mustafa](https://developer.sailpoint.com/discuss/u/Muhammad_Mustafa)\
**Post date:** [April 9, 2024, 1:38pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/9 "2024-04-09T13:38:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amanKsingh](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amanKsingh](https://developer.sailpoint.com/discuss/u/amanKsingh)\
**Post date:** [May 22, 2024, 6:46am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/10 "2024-05-22T06:46:14Z")

</div>

Hi all, Still I am facing the same issue.

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

---

<div class="post-metadata">

**Author:** ![rajeshjakkula](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rajeshjakkula](https://developer.sailpoint.com/discuss/u/rajeshjakkula)\
**Post date:** [June 21, 2024, 12:39am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/11 "2024-06-21T00:39:28Z")

</div>

Hi Aman,

I am facing same issue,  
Were you able to find solution to this

If so, can you share  
What did you set for context url and the pagination config

Thanks,  
Rajesh

---

<div class="post-metadata">

**Author:** ![Remold](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/remold/32/3275_2.png) [@Remold](https://developer.sailpoint.com/discuss/u/Remold)\
**Post date:** [June 22, 2024, 1:07pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/12 "2024-06-22T13:07:59Z")

</div>

Hi @rajeshjakkula,

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](https://documentation.sailpoint.com/connectors/identityiq8_3/webservices/help/integrating_webservices/pagination.html)

All webservices are slightly different when looking for the pagination.

For the above issue, I doubt that this issue is related to the pagination, as it gets more accounts than the page size (122 over 100). It looks like there is an issue with the identity attribute (multiple accounts with the same identity attribute).

To see what is response is from the web servers call, you can use the following code for the Web Services After Operation Rule:

```auto
log.error("rawResponseObject=" + rawResponseObject);
log.error("processedResponseObject=" + processedResponseObject);

Map updatedMapInfo = new HashMap();
updatedMapInfo.put("data", processedResponseObject);
return updatedMapInfo;

```

If you have further queries, please open a separate thread in this forum. So we can isolate your issue from Aman’s.

– Remold

---

<div class="post-metadata">

**Author:** ![Muhammad\_Mustafa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/muhammad_mustafa/32/27611_2.png) [@Muhammad\_Mustafa](https://developer.sailpoint.com/discuss/u/Muhammad_Mustafa)\
**Post date:** [June 23, 2024, 10:27am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/13 "2024-06-23T10:27:48Z")

</div>

Hi @rajeshjakkula and Welcome to the community!!!

If you can elaborate more about what you are doing and the nature of the APIs that would be great so we can able to help you because maybe your issue is different than @amanKsingh’s one.

However, if it’s the same, I can go with you and @amanKsingh on a quick call as previously offered to check with you guys, because again as mentioned by @Remold & I second that 🙂 “All webservices are slightly different when looking for the pagination.  
For the above issue, I doubt that this issue is related to the pagination”

---

<div class="post-metadata">

**Author:** ![HarithaGollavilli](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@HarithaGollavilli](https://developer.sailpoint.com/discuss/u/HarithaGollavilli)\
**Post date:** [July 22, 2024, 6:46am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/14 "2024-07-22T06:46:03Z")

</div>

Hi all, am also facing the same issue for the same requirement. Could anyone provide the solution.

---

<div class="post-metadata">

**Author:** ![dylanfoggan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dylanfoggan/32/13658_2.png) [@dylanfoggan](https://developer.sailpoint.com/discuss/u/dylanfoggan)\
**Post date:** [July 22, 2024, 8:51am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/15 "2024-07-22T08:51:51Z")

</div>

Hi @amanKsingh , @HarithaGollavilli ,

I think you should assign the limit first, please take a look at this example and let me know if this helps.

```auto
$sysparm_limit$ = 100
TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$

$offset_index$ = $start_index$ + $sysparm_limit$

$endpoint.fullUrl$ = $application.baseUrl$ + "/devapi/user_management/v6/users?offset=" + $offset_index$ + "&limit=100&include_custom_fields=true"

```

Thanks,

---

<div class="post-metadata">

**Author:** ![HarithaGollavilli](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@HarithaGollavilli](https://developer.sailpoint.com/discuss/u/HarithaGollavilli)\
**Post date:** [July 22, 2024, 11:05am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/16 "2024-07-22T11:05:58Z")

</div>

Hi @dylanfoggan

It is pulling only 300 users (totalResults are 1420) and response is

“totalResults”: 1420,  
“startIndex”: 1,  
“itemsPerPage”: 100,

Below are the paging steps.

$sysparm\_limit$ = 100  
TERMINATE\_IF $RECORDS\_COUNT$ \< $sysparm\_limit$  
$offset\_index$ = $start\_index$ + $sysparm\_limit$  
$endpoint.fullUrl$ = $application.baseUrl$ + “/scim/v3/Users?startIndex=” + $offset\_index$ + “&count=100”

Could you please help me to fix this

---

<div class="post-metadata">

**Author:** ![dylanfoggan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dylanfoggan/32/13658_2.png) [@dylanfoggan](https://developer.sailpoint.com/discuss/u/dylanfoggan)\
**Post date:** [July 22, 2024, 11:50am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/17 "2024-07-22T11:50:53Z")

</div>

Hi @HarithaGollavilli ,

One thing to confirm, do you perhaps have any AfterOperationRules attached to this aggregation?

Another thing, could you please provide the context URL you are using in the Operation.

Thanks,

---

<div class="post-metadata">

**Author:** ![HarithaGollavilli](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@HarithaGollavilli](https://developer.sailpoint.com/discuss/u/HarithaGollavilli)\
**Post date:** [July 22, 2024, 11:38pm UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/18 "2024-07-22T23:38:13Z")

</div>

HI @dylanfoggan

yes am using AfterOpertionRule.  
if (processedResponseObject != null) {   
for (Map account : processedResponseObject) {  
boolean accountStatus = account.get(“active”) != null  
? Boolean.parseBoolean((String) account.get(“active”))  
: false;  
log.error("accountStatus: " + accountStatus);  
if (accountStatus) {  
account.put(“IDN\_AccountUAR”, “Review Account”);  
}  
}  
}  
ContextURL is /scim/v3/Users

---

<div class="post-metadata">

**Author:** ![dylanfoggan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dylanfoggan/32/13658_2.png) [@dylanfoggan](https://developer.sailpoint.com/discuss/u/dylanfoggan)\
**Post date:** [July 23, 2024, 8:28am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/19 "2024-07-23T08:28:55Z")

</div>

Hi @HarithaGollavilli

Could you please adjust your context URL as such:

```auto
/scim/v3/Users?startIndex=1&count=100

```

another thing you could perhaps try along this is remove the AfterOperationRule for testing to ensure it is not causing any issues.

Thanks,

---

<div class="post-metadata">

**Author:** ![bhanuprakashkuruva](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/bhanuprakashkuruva/32/22154_2.png) [@bhanuprakashkuruva](https://developer.sailpoint.com/discuss/u/bhanuprakashkuruva)\
**Post date:** [July 26, 2024, 6:18am UTC](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944/20 "2024-07-26T06:18:10Z")

</div>

Besides, above all replies, the native application should support pagination; then only that will work. Otherwise, it will not work. I have seen a couple of applications that do not support pagination, like Axero, etc. Please consult with the application team and get confirmation that this is going to allow us to do all these things.

[Next page](https://developer.sailpoint.com/discuss/t/how-to-do-paging-in-web-service-connector/38944.md?page=2)
