APIs & Integrations

Not applicable

How "offset" and "has-more" parameters exeactly work?

SOLVE

Hi all,

In our case we have around 9,000 companies records. and i want to get all those companies records. so i want to use this end point https://developers.hubspot.com/docs/methods/companies/get-all-companies . now i specify a limit of 100 as follow https://api.hubapi.com/companies/v2/companies/paged?hapikey=demo&properties=name&properties=website&...

so on each response i will get the 100 companies info + offset number + the has-more will be true..
so i ended up in an infinite loop... so how i can get all the 9,000 records? as i am unable to know when i should stop ,, as seems i will always get an offset number and the has-more will always be true??

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

How "offset" and "has-more" parameters exeactly work?

SOLVE

Hey, @johnjohn123.

Sorry if I wasn't clear in this post:

The reason I say "IF has-more is true" is because it will turn false once you have paged through all the companies. Basically, keep calling the endpoint with each offset value returned until the endpoint returns "has-more": false. Then you can stop because you have gotten all the companies.

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
2 Replies 2
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

How "offset" and "has-more" parameters exeactly work?

SOLVE

Hey, @johnjohn123.

Sorry if I wasn't clear in this post:

The reason I say "IF has-more is true" is because it will turn false once you have paged through all the companies. Basically, keep calling the endpoint with each offset value returned until the endpoint returns "has-more": false. Then you can stop because you have gotten all the companies.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Not applicable

How "offset" and "has-more" parameters exeactly work?

SOLVE

yes you are correct.. actually i flag my question as invalid,, because i realized that i am not facing any issue...
Thanks for your help anyway..

0 Upvotes