# WebService Connector: Paginating Google API

**URL:** <https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843>\
**Category:** SHF Discussion and Questions\
**Tags:** webservice-connector\
**Created:** [January 27, 2023, 2:22pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843 "2023-01-27T14:22:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Augusto-Dallape](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Augusto-Dallape](https://developer.sailpoint.com/discuss/u/Augusto-Dallape)\
**Post date:** [January 27, 2023, 2:22pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/1 "2023-01-27T14:22:54Z")

</div>

Hey im triying to page google APIs and it has the same logic as yours, but by some reason it gets stuck looping in the first request. Any ideas? This is the paging im using:

TERMINATE\_IF $response.nextPageToken$ == NULL  
$endpoint.fullUrl$ = $application.baseUrl$ +“/admin/directory/v1/users?[domain=beta.lan.com](http://domain=beta.lan.com)&maxResults=10&pageToken=”+ $response.nextPageToken$

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [January 27, 2023, 3:52pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/2 "2023-01-27T15:52:09Z")

</div>

Not sure if this helps, but here is an example offset based pagination.

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

There’s also this doc: [Paging Based on Response Markers](https://documentation.sailpoint.com/connectors/webservices/help/integrating_webservices/paging_based_on_response_markers.html)

---

<div class="post-metadata">

**Author:** ![Augusto-Dallape](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Augusto-Dallape](https://developer.sailpoint.com/discuss/u/Augusto-Dallape)\
**Post date:** [January 27, 2023, 4:03pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/3 "2023-01-27T16:03:02Z")

</div>

What im trying to accomplish is done with nextPageTokens, thus it provides me a token inside the request body, which i need to send as a query parameter in the next aggregation page…

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

---

<div class="post-metadata">

**Author:** ![ruben\_elizondo](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@ruben\_elizondo](https://developer.sailpoint.com/discuss/u/ruben_elizondo)\
**Post date:** [January 27, 2023, 5:00pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/4 "2023-01-27T17:00:05Z")

</div>

Colins previous suggestion of using a before operation rule would apply here as well. [Documentation Link](https://documentation.sailpoint.com/connectors/webservices/help/integrating_webservices/beforeoperationrule.html)

---

<div class="post-metadata">

**Author:** ![M\_rtenH](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/m_rtenh/32/429_2.png) [@M\_rtenH](https://developer.sailpoint.com/discuss/u/M_rtenH)\
**Post date:** [January 31, 2023, 3:13pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/5 "2023-01-31T15:13:09Z")

</div>

```auto
TERMINATE_IF $response.nextPageToken$ == NULL
$next$ = $response.nextPageToken$
$endpoint.fullUrl$ = $application.baseUrl$ + "/users?maxResults=10&pageToken=" + $next$

```

works for me. Technically it’s doing the same exact thing but I’m declaring the nextPageToken as a separate variable

Before operation rule shouldn’t be necessary unless Google is also including special characters that cause java errors in the their page token which I haven’t experienced yet

edit: I’m not a 100% sure if nextpagetoken is always included, does your context url also include maxResults=10?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:24pm UTC](https://developer.sailpoint.com/discuss/t/webservice-connector-paginating-google-api/7843/6 "2023-07-19T14:24:12Z")

</div>


