I am trying to split out an item which contains more than 2700 sub-items.
When I do it using Item Lists node, it only return the 100 first items as you can see in the screenshot :
My first thought here is next to the highlighted total it has Count and Limit which are both set to 100 so to me this looks like it is working as expected and you may need to implement a pagination loop with the API you are using to get the other 2605 records.
Use the offset parameter to get all orders in a store.
For example, if a store has 452 orders, you would need to call the /orders endpoint 5 times with different offset parameter values: offset=0 // 0-100 orders offset=100 // 100-200 orders offset=200 // 200-300 orders offset=300 // 300-400 orders offset=400 // 400-452 orders
As a result, you will get all 452 orders after these 5 consecutive requests.
Hi @PrintEurope, pagination can be implemented using a loop like so for example:
I don’t have access to your API, but you should be able to adjust the example. I am using the $runIndex here to keep track of how often the loop has been running. Since your API expects an offset rather than a page number you probably want to use {{ $runIndex * 100 }} on the Set node and replace the page query parameter with the offset parameter required by your API. For the IF node you’d need to find a suitable comparison taking your data structure into account.
Hi @PrintEurope, the code would expect the name of the node, not the field. So, if the node you want to take the data from is called HTTP Request, the code would look like so:
let results = [],
i = 0;
do {
try {
results = results.concat($("HTTP Request").all(0, i));
} catch (error) {
return results;
}
i++;
} while (true);
After merging the items through the code node you could then use an Item Lists node to split out the items field itself.
The syntax of $("node-name").all(branchIndex?, runIndex?) would be documented here.