How to get all contacts property values using API?

SOLVE
Benchmark_achen
Participant

Hi,

I was able to use the Hubspot API post/create new contacts in Hubspot using data from our database.  Now, I want to GET these contacts data back along with their associated contact vid.  I used the following API and it doesn't seem to work:

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all&property=vid&property=bnid_&property=email

 

(note:  bnid_ is a custom property)

 

Let me know what need to be changed on the API in order to make it work.

 

Thanks,

Allan

0 Upvotes
1 Accepted solution
lscanlan
Solution
HubSpot Alumni

Hi @Benchmark_achen,

 

When you get data back from the endpoint documented here: https://developers.hubspot.com/docs/methods/contacts/get_contacts, you should be getting the contact's vid in the response, along with the specific properties you're requesting. If you're making the request to the exact URL you wrote:

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all&property=vid&property=bnid_&property=email

that actually is beginning the query string incorrectly. propery=XXXX should be a query string parameter. So you actually want to be making your request to something like:

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=bnid_&property=email

Take note that I've changed & to ? before the first query string parameter. I've also removed property=vid because that vid is not a contact property, but rather is unique to the contact record itself. If you make the request to that URL, you should get the specific properties you're requesting, along with some other information about the contact record, including the vid.

 

If you're still having trouble, let me know how you're making the request and I'll be happy to look again.

 

Leland Scanlan

HubSpot Developer Support

View solution in original post

3 Replies 3
WBHydrosense
Participant

Hi All, 

 

Appologies if I am commenting in the wrong section but the parapiter for the maximum contact records you can get using this API is 100, is there a workaround to get all? if not what would be the api call for subsquient records when 'has-more' is true? 

 

Thank you!

 

Will

0 Upvotes
lscanlan
Solution
HubSpot Alumni

Hi @Benchmark_achen,

 

When you get data back from the endpoint documented here: https://developers.hubspot.com/docs/methods/contacts/get_contacts, you should be getting the contact's vid in the response, along with the specific properties you're requesting. If you're making the request to the exact URL you wrote:

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all&property=vid&property=bnid_&property=email

that actually is beginning the query string incorrectly. propery=XXXX should be a query string parameter. So you actually want to be making your request to something like:

 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=bnid_&property=email

Take note that I've changed & to ? before the first query string parameter. I've also removed property=vid because that vid is not a contact property, but rather is unique to the contact record itself. If you make the request to that URL, you should get the specific properties you're requesting, along with some other information about the contact record, including the vid.

 

If you're still having trouble, let me know how you're making the request and I'll be happy to look again.

 

Leland Scanlan

HubSpot Developer Support
Benchmark_achen
Participant

Thank you Leland!  Your suggestion works!  I'm learning new things everyday on this Hubspot integration project...Smiley Happy

 

--Allan