Hubspot API pagination help!

Hey! I’ve been trying to figure out how to properly loop through Hubspot’s API pagination. I figured out a convoluted method that works… but I assume there’s a much more efficient method than the one I’m using. TIA :raised_hands:

Hi @madhatter349 (I love your username!) - could you share your workflow’s code just so we can take a little bit of a closer look at it more easily? :slight_smile:

1 Like

Thanks in advance!

@MutedJam and I worked this out using Hubspot’s pagination in their API:

That might work better for you! This is using the paging.next.after option in their API :slight_smile:

1 Like

@EmeraldHerald & @MutedJam amazing amazing!!

99.9% but I figured out how to get it to 100% - Your code had the JSON as “operator”: “NEQ” this was causing an infinite loop, I changed it to “operator”: “EQ” and now I am getting the exact output needed.

I really appreciate the help!! Is there a way to take the split out result list and merge it into 1 singular list?

2 Likes

No problem, @madhatter349 :slight_smile: Actually, what you’re looking for is probably here: Merge multiple runs into one | n8n workflow template

Take a look at the code node in that example, it should get this sorted for you!

Thank you again for all your help.

The API splits it into 6 runs, so the item list has 1 of 6, 2 of 6, etc… Is there a way to merge the 6 into 1?

Hi @madhatter349 - Did a little editing of that code node from the example I linked you earlier, this workflow should do exactly what you’re looking for:

Let me know if that helps!

1 Like

This is AMAZING, thank you so much for you help!!!

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.