APIs & Integrations

LWang
Member

get contacts

Dear Hubspot, when I use the api to get the information in the contacts, the first time I query the data, the number of data is correct, but when new data enters after a period of time, I will use vidOffset to query the data again , The number of data items will be wrong. Excuse me, is there a way to sort by fields when I search?

0 Upvotes
8 Replies 8
LWang
Member

get contacts

I read the relevant chapters, that is not what I want, I can find the normal data, but when I use vidOffset to check the newly added data for the second time, there will be less data, and the data will be found. The number of items is inconsistent with the number of items in Hubspot contacts.
https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&count=250

0 Upvotes
taran42
Contributor

get contacts

Hello @LWang. If I am understanding you correctly, you are making a call for your contacts, which is giving you X number of contacts, then you are making an additional call which is giving you Y (which is less than the first call). 

 

Hubspot will only allow 100 contacts per call. You have to use pagination to get additional contacts past the first 100, which I think is what you're doing. Let's say you have 125 contacts. Your first call will give you the first 100 contacts, and then you use the has_more function to get the additional 25. 

 

In using a function like vidOffset, you're going to get different numbers of contacts depending on what number you set vidOffset to.

 

Refer to this page on how to get all contacts in v2 of the API: https://legacydocs.hubspot.com/docs/methods/contacts/get_contacts 

LWang
Member

get contacts

I know this,
The current situation is like this, for example:
I had 125 pieces of data in my contacts yesterday. I exported 125 pieces of data according to the API. This is normal. Then I stopped the api export. Today I continue to use the last vid-offset returned to me yesterday and use vidOffset to query. It will appear that the number of data items is incorrect. Have you ever encountered such a situation?
Because I have a large amount of data, there is no way to eliminate it.

0 Upvotes
taran42
Contributor

get contacts

Is there a reason why you're using vidOffset instead of hasMore to get additional contacts? How many contacts overall are you expecting to retrieve? I have upwards of 1000 and was able to retrieve them all in one call in just a few minutes.

LWang
Member

get contacts

I have millions of data. I check it together based on hasMore and vidOffset. When hasMore is true, I bring in the vidOffset returned each time and check it together. If the query is concentrated in a time period, it is correct, but when the interval If you check again in one or two days, it will lack data. I don’t know why.

0 Upvotes
taran42
Contributor

get contacts

I'm at a loss on this one. Perhaps @dennisedson knows someone else that may be able help out. Good luck in finding an answer!

dennisedson
HubSpot Product Team
HubSpot Product Team

get contacts

Thanks for trying @taran42 !

@himanshurauthan , @MatthewShepherd , @jpsanchez  do you all have thoughts?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

get contacts

Hi @LWang 

Throwing @taran42 into the conversation. 

Might be helpful to be specific with the endpoint that you are hitting and maybe elaborate a bit more on  your process.

0 Upvotes