APIs & Integrations

jstulberg
Member

Help requesting large number of Contacts Records

We have 42,000+ Contacts in our portal. We need to retrieve all of the Contact Properties for each Contact through the API. I’m trying to determine the best way to do that within the daily API request limit.

We can’t Get a Contact by ID individually. We could Get all Contacts, max of 100 returned. Then Get a batch of Contacts with VIDs with the same 100 VIDs previously returned in the request. This would result in 420 calls.

  1. Would you recommend this method or an alternative?
  2. Can you provide any documentation guidance on parsing the response, the nested properties are pretty dense.

Thanks -

Jason

0 Upvotes
18 Replies 18
ddahill
Member

Help requesting large number of Contacts Records

The filecontent should contain a full json data set for each of the vIDs submitted. See eample response when I call the method og Get Contact by ID for a single contact…

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

0 Upvotes
ddahill
Member

Help requesting large number of Contacts Records

That did the trick. Thank you.

0 Upvotes
ddahill
Member

Help requesting large number of Contacts Records

File content comes back emply. Only { }

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@ddahill You don’t have anything in what you posted above that contains File or { }. Can you provide me an example with that in it?

0 Upvotes
ddahill
Member

Help requesting large number of Contacts Records

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@ddahill Ahhh now I see what you are referring too. I’m not a cold fusion expert and don’t come across this screen too often. What would you expect there? It looks like it returned a 200 and I saw the list of VIDs above.

0 Upvotes
ddahill
Member

Help requesting large number of Contacts Records

Can you think of reasons why a call to this method is returning empty file content “{ }”?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@ddahill Can you post the full return of the call? Are you seeing everything else?

0 Upvotes
ddahill
Member

Help requesting large number of Contacts Records

Request URL:
https://api.hubapi.com/contacts/v1/contact/vids/batch/?hapikey=XXXXX&propertyMode=value_only&formSub...
Request Method:GET
Status Code:200 OK
Remote Address:23.204.17.246:443
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Access-Control-Allow-Credentials:false
Connection:keep-alive
Content-Encoding:gzip
Content-Length:22
Content-Type:application/json; charset=UTF-8
Vary:Accept-Encoding
Vary:Accept-Encoding
X-N:S
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:hubspotapi-csrf=wa3Xc2YhoG31OC1TTzKXLg; hubspotapi-prefs=1;
hubspotapi=AJXaV51okS3Ncbe_tcX6Tk1UJTl3igqWXGWMzIFgwHddLsx-kw0wGLZvjzRhqgmNurz7LDzrKe6Ej9N4mah0P3owDNJufr_n7XkiZCwqxpuEbH-ODce68ozA7QhiCveuW6EmAkC7lgsw5Im602zCI58k16a18IqusS0zNqij9Oo2ndqx4ErgRKbD84FR_1taZl5NFQ6EZHrRVELGiNAr9aDWk7aCFZF9S5094XBsGYHsGZ8iShZHotM;
__hluid=017a7694-8d38-4e69-955a-709428d5090c
Host:api.hubapi.com
Pragma:no-cache
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Query String Parameters
view source
view URL encoded
hapikey:XXXXXXX
propertyMode:value_only
formSubmissionMode:none
showListMemberships:false
vID:166826
vID:166876
vID:166926
vID:167076
vID:167077
vID:168826
vID:170476
vID:170526
vID:185426
vID:222276
vID:275626
vID:314176
vID:322426
vID:327876
vID:336926
vID:355676

Thanks for assisting.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@ddahill I don’t see anything about your file content in your response?

0 Upvotes
SGiese
Member

Help requesting large number of Contacts Records

@jstulberg I connected with @pmanca and our development team.

The Get a batch of contacts by vid endpoint has been updated and it should be able to get everything we’d have for a record. We are updating the documentation to remove the line mentioning it will get much as it is inaccurate now.

Sorry for the confusion. Wanted to send that information along.

0 Upvotes
jstulberg
Member

Help requesting large number of Contacts Records

thanks for clarifying @pmanca and @SGiese. this looks like a workable path for us.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@jstulberg You would have to use the Get a contact by ID endpoint in order to retrieve all of the contact properties. You could page through get all contacts to get all of the VIDs and then use that to loop through the Get a Contact by ID. Since you have 42,000 contacts you will exceed your daily limit. You can purchase the API add-on if you want to which would increase your daily limit from 40k to 160k.

0 Upvotes
jstulberg
Member

Help requesting large number of Contacts Records

Why can’t we use the Get a batch of Contacts with VIDS? It looks like Contact properties are returned.

Get a batch of contacts by vid

GET /contacts/v1/contact/vids/batch/ - For a given portal, return information about a group of contacts by their unique ID's. A contact's unique ID's is stored in a field called 'vid' which stands for 'visitor ID'.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@jstulberg it will return most of the properties but not all.

0 Upvotes
jstulberg
Member

Help requesting large number of Contacts Records

ok, got it. Can you be a bit more specific about which properties or point me to some documentation?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Help requesting large number of Contacts Records

@jstulberg

I pulled this from the docs

This method will also return you much of the HubSpot lead “intelligence” for each requested contact record. The endpoint accepts many query parameters that allow for customization based on a variety of integration use cases.

This could very well solve your use case. I might have been overly stringent on your word of “all” properties and wanted to make sure I wasn’t setting the wrong expectations.

0 Upvotes