How to deal with paging in post response

Hello all,
I have to deal with API with paging. In the body of the response I received not only data but also cursor(pointer to the next page of data). I used REST POST snap.
The API was designed to return a large dataset and that’s why the API should be kicked-off couple times with the same input parameters + pointer to the next page.
For now, I have no Idea how to implement this correctly.
Appreciated for any help.

Response looks like above.
The data I need its entity array. Cursor - pointer to the next page

Rest GET has built in pagination feature. Looks like POST does not. Maybe you can build a Parent pipeline that repeatedly calls a child pipeline with the cursor?

We are working on a similar solution with Rest GET where a parent pipeline calls a child that gets one batch at a time. As long as there are more pages we call the child again.

Thank you for responding. After some time I’ve implemented recursive pipeline which does almost the same as foreach loop in programming languages.

1 Like

any way you can share your solution? i’m working on similar pipeline, we are now getting empty results from a 500 or 403, so do you have any thoughts on that?

Hello, not sure that I can, but here it is a skeleton.
The main idea is if we received an error, we should recall the pipeline with the same parameters, if not we should call the pipeline with the same parameter except cursor( in my case). I got value for the cursor parameter and check it before next iteration. If it not null I recall pipeline with the new cursor + all parameters.
Get next id’s list and recurse snap I used for call the pipeline again

1 Like

Thank you, Ed. I think we’re on the same page!