How to pull a all data from a paged REST API

FOR HUBSPOT USERS: I just got it to work thanks to GPT-4. Here is my use case and how I got it working:

**Use case **

  • I wanted to get all Tasks and display them in a table in Retool

Solution

  • Create a HubSpot call to Tasks (or whichever object you are doing) with the following parameters - called it getTasks
  • Create a new JS query called getALLData with the following code

One thing I noticed is that when you reach the last page, HubSpot omits the paging parameter. So you have to end the loop when you cannot find the paging parameter. BOOM! It works!

1 Like