HubSpot Deals API - Having trouble getting server-side pagination working to pull in all deals

Hello, I'm fairly new to retool. I've been learning on the fly and the forums have helped a lot, but after a ton of research into just about anything related to server-side pagination for APIs, I'm just stuck on how best to accomplish this for the particular HubSpot API. We have a working HubSpot API that's pulling in the deals objects. It's default to 10 deals on the pull, but I need to be able to pull in all deals so I can break out different metrics for an exec dashboard of sorts. I'm just struggling on how best to call all our deals from our HubSpot into retool so I can start measuring those different metrics and not just off a subset of the 100 limit the API establishes. I believe cursor based pagination may solve this?

I just have no clue what that all requires in Retool itself. What JavaScript do I need to be putting on the table itself for server-side pagination? Do I have to create JS queries or transformers to accomplish this, etc? How can I best capture "all" deal data from the HubSpot API so I can then calculate and manipulate that data in Retool itself? I've attached a couple screenshots to show the API is working and some of the API data results. I just need a good push in the right direction. If I can get a clear understanding of how to accomplish this with our HubSpot Deals object, I feel confident I can do it with other objects we may need as well. Please let me know if you have any questions or need additional information from me. Thank you!

Any retool support able to follow up with me on this? Thank you!

@Kabirdas Hi, I've seen you help across the forum and have helped me troubleshoot a lot of other retool building by digging through the forums so first, thank you. Second, is there anyway you can help me with the above issue? I just need to get this nailed down for the HubSpot API, and also a very similar case to what you laid out for Help writing JS code for pagination - #10 by Dimitri_Lianoudakis as well. I just need to be able to pull in "all" data starting with the deals object past the 100 limit so I can make manipulate and build off it in Retool.

Hi @Kevin_Christensen Glad to hear the forums have been helpful!

Here's another example of getting all pages of a cursor based paginated api. Keep in mind that with these examples, you'll run the JS query first, which triggers your api, and then all of the results will be returned in the JS query. So, if you want to use the api data in a calculation or component, you'll reference Here's another post specific to hubspot.

Happy to take a look at your JS query if you can share a screenshot here, along with an updated screenshot of the hubspot query :slightly_smiling_face:

Hi @Tess, thank you for following up. Okay it makes sense about running the JS query first. Please see the attached screenshots. The current JS query is still returning undefined.

I was able to get the JS query working and pulling all the deals from HubSpot. The table pagination is working and I can see the total number deals is correct to what's in HubSpot. I'm pasting the screenshots below for anyone who it might benefit for the HubSpot API specifically. Thanks!

Apologies for the delay in circling back, but I'm so glad to hear you have a solution! Really appreciate you sharing what worked