# Custom API Integration Pagination

**URL:** <https://discuss.elastic.co/t/custom-api-integration-pagination/355978>\
**Category:** Kibana\
**Created:** [March 22, 2024, 10:08am UTC](https://discuss.elastic.co/t/custom-api-integration-pagination/355978 "2024-03-22T10:08:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jiawei\_Cheah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jiawei_cheah/32/124808_2.png) [@Jiawei\_Cheah](https://discuss.elastic.co/u/Jiawei_Cheah)\
**Post date:** [March 22, 2024, 10:08am UTC](https://discuss.elastic.co/t/custom-api-integration-pagination/355978/1 "2024-03-22T10:08:38Z")

</div>

Hi, i am running issues when i am trying to achieve pagination within this API.

In this case, I have indicated that if the offset is not equal to the total, the offset number will increment by 100 for the next call.

The API Integration on Elastic seems to be working fine if I don't add in the condition but this will cause it to be an endless increment loop.

Code Used in Response Pagination Section:

- set:  
target: url.params.offset  
value: '[[if ne (toInt (.last\_response.body.meta.pagination.offset)) (toInt (.last\_response.meta.pagination.total))]] [[add (toInt (.last\_response.url.params.Get "offset")) 100]] [[end]]'

API results from Postman

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/4/c4db8b851adb8d83711f7f3418e3a849f209b354.png)

Can anyone let me know what am I doing wrong??

Thanks!

---

<div class="post-metadata">

**Author:** ![Jiawei\_Cheah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jiawei_cheah/32/124808_2.png) [@Jiawei\_Cheah](https://discuss.elastic.co/u/Jiawei_Cheah)\
**Post date:** [March 22, 2024, 10:09am UTC](https://discuss.elastic.co/t/custom-api-integration-pagination/355978/2 "2024-03-22T10:09:27Z")

</div>

I am using the Custom API Integration function.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/2/5238c69bc0793afe730f64b9f338d0ead37e5b71.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 19, 2024, 10:09am UTC](https://discuss.elastic.co/t/custom-api-integration-pagination/355978/3 "2024-04-19T10:09:41Z")

</div>

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