# Custom API intergration - Response Pagination

**URL:** <https://discuss.elastic.co/t/custom-api-intergration-response-pagination/356396>\
**Category:** Elastic Agent\
**Created:** [March 28, 2024, 12:58pm UTC](https://discuss.elastic.co/t/custom-api-intergration-response-pagination/356396 "2024-03-28T12:58:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rrensen/32/133071_2.png) [@rrensen](https://discuss.elastic.co/u/rrensen)\
**Post date:** [March 28, 2024, 12:58pm UTC](https://discuss.elastic.co/t/custom-api-intergration-response-pagination/356396/1 "2024-03-28T12:58:25Z")

</div>

Hi, i am trying to achieve pagination with the Custom API.  
The response header of the original call has the following information

```auto
Date: Wed, 27 Mar 2024 14:51:36 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Robots-Tag: none
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT

Link: 
<https://api.meraki.com/api/v1/111/bySwitch?perPage=50&startingAfter=Q222-2222-2222>; rel=first, 
<https://api.meraki.com/api/v1/111/bySwitch?perPage=50&startingAfter=QQQQ-1234-ABCD>; rel=next, 
<https://api.meraki.com/api/v1/111/bySwitch?endingBefore=QZZZ-ZZZZ-ZZZZ&perPage=50>; rel=last

```

The API Integration on Elastic is working as I get the data of the first page in.  
But from the documentation it is not clear what I should configure for pagination  
Is here someone who can assist?

---

<div class="post-metadata">

**Author:** ![Denis\_Pudov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/denis_pudov/32/126492_2.png) [@Denis\_Pudov](https://discuss.elastic.co/u/Denis_Pudov)\
**Post date:** [April 19, 2024, 2:55pm UTC](https://discuss.elastic.co/t/custom-api-intergration-response-pagination/356396/2 "2024-04-19T14:55:01Z")

</div>

Hi.

There is example for the pagination in docs: [link](https://www.elastic.co/guide/en/beats/filebeat/8.12/filebeat-input-httpjson.html).  
Looks that you should extract a something like page\_id from the response body and set value as query params or the request body:

```yaml
    - set:
        target: url.params.scroll_id
        value: '[[.last_response.body._scroll_id]]'
    - set:
        target: body.scroll
        value: 5m

```

By the way you can try another integration - [CEL](https://www.elastic.co/guide/en/beats/filebeat/8.12/filebeat-input-cel.html)

---

<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:** [May 17, 2024, 2:55pm UTC](https://discuss.elastic.co/t/custom-api-intergration-response-pagination/356396/3 "2024-05-17T14:55:23Z")

</div>

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