Using a loop block to gather all results from a REST API

Hey @tomrezoando,

I think the way the API is structured requires you to make an initial API call to determine whether or not you need to make successive calls. The first query would go into a branch that checks for the status code and when == 206, can be sent along to a code based loop which would be able to determine how many new queries need to be made to gather and return all of the results.

Here's a little example of a theoretical type of workflow to use -- I am uncertain of the actual response header locations so I made some assumptions in the code block:

There's probably more efficient ways of making the looped queries, but this is more of a proof of concept that I think you are looking for. In this example, you'd still have to join in the data from the results of the initial query (which would return either 100 items + the Content-Range header or just give you all of the items available if there were less than 100, but that is something which can be explored via the Else/Else-If functions branch node as well).

Hope this helps. If you have other questions or I misunderstood your intent, let me know!

1 Like