$pageCount
will increment for each request in the pagination within the actual pagination section.
If you want to change the offset by 500 each time, use {{ $pageCount * 500 || 0 }}
The || 0
part of the expression sets the default value to 0 if $pageCount
is undefined, which it is on the first one. (If their data starts at 1 instead of 0 then you should put {{ $pageCount * 500 + 1 || 0 }}
)
Then you just set type
to body.
See that in action in this node
I set up an endpoint to return the data back, and this is what this sends back, showing it’s working.
(Edit: huh I notice now this picture does not show it working. But I promise this does infact work)
I suspect you’ll run into an issue because it doesn’t let you nest that json in the pagination section, it looks like it needs to be under params/args
.
You can still make that work, it will just be a lot more complicated because you’ll need to set up a loop instead of just letting the HTTP node handle it. I made the whole thing here:
You will need to adapt this to work for you in terms of the amount of loops you have run.
I tested by pinning 3 items in the webhook and passing those in to make the loop run 3 times.
In the body of the json in the HTTP request {{ $('Loop Over Items').context["currentRunIndex"] * $json.limit || 0 }}
is setting the offset. $('Loop Over Items').context["currentRunIndex"]
gets the current loop of the Loop Over Items
node
$json.limit
is from the Set Variable For Batch SIze/limit
node. I set the size there so that you only had to change it in one place. I set it to 50 for my testing, you can go in and change it to 500.
Let me know if any of this doesn’t make sense and if you have any follow up questions or need help getting it to work for your usecase.