Custom API Integration Pagination

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

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

Thanks!

I am using the Custom API Integration function.