Pagination with offset

I need help regarding pagination in Action River.

My requirement is I need to call the API

https://{apidomainurl}?sIndex=0&limit=200]

I want to increment the sIndex value with 200 for every Iteration. I want to do this until the API responds with an error response like this

{

“response”: {

“message”: “Error occurred”,

“uri”: “apidomain”,

“errors”: {

“code”: 7024,

“message”: “No records found”

},

“status”: 1

}

}

I am not sure how to do this with Rivery. I tried the “pagination with offset” option but do not know how to increment the value in terms of 200 and also, I do not know how to give the key in response and value to stop.

Kindly help me figure this out.

Hi Jeya,

Have you tried this?

It will start with an offset=0 and pass it in the query with the key “sIndex”, and it will stop whenever the page size is smaller than 200. Don’t forget to add the limit=200 in the query params

Let us know if this works
Romy

Thanks Romy for your quick response.

This is working.

I have another query, I need to call the Rest API of Rivery.I want to run the river using a rest API. where can I find the details of cross-river-id, environment id and account id in the UI.

Thanks,
Jeya

Hi @Jeya_rajaguru these details are in the URL of any river. For example:

https://console.rivery.io/river/{account_id}/{environment_id}/river/{cross_river_id}

Hi Romy,

The solution provided helped in stopping at the correct place. But how does the SIndex value increment in the next iteration, will it go to 1 or 200?

Right now, the data I have only elements less than 200, so it is working for me. But what if the data has 300 elements?
In the first iteration it will get items from 0 to 199; in the second iteration will it get from 1 to 200 or 200 to 300?

Could you please help.

Thanks
Jeya

sorry to bother you Romy.It is working as expected.

Thanks,
Jeya

1 Like

Thanks for confirming Jeya, don’t hesitate if you have any other questions!

Best
Romy