APIs & Integrations

Benchmark_achen
参加者

How to get all contacts property values using API?

解決

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 いいね!
1件の承認済みベストアンサー
lscanlan
解決策
元HubSpot社員
元HubSpot社員

How to get all contacts property values using API?

解決

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

元の投稿で解決策を見る

3件の返信
WBHydrosense
参加者

How to get all contacts property values using API?

解決

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 いいね!
lscanlan
解決策
元HubSpot社員
元HubSpot社員

How to get all contacts property values using API?

解決

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
参加者

How to get all contacts property values using API?

解決

Thank you Leland!  Your suggestion works!  I'm learning new things everyday on this Hubspot integration project...スマイリー ハッピー

 

--Allan