APIs & Integrations

whitfty1
Member

Update a Contact Property Across All Contacts via API

Is there a quick and easy way to update a Contact Property across all Contacts via API? Or is the only way to loop through each contact in HS and update the field?

0 Upvotes
2 Replies 2
whitfty1
Member

Update a Contact Property Across All Contacts via API

Sure, and thanks for your responses. We have Asset within Salesforce that is called Training Credit. For contacts that have this Asset and it has not been consumed, we send out a set of different Training emails from HS. Because HubSpot doens’t have way to pull Assets and specifically the one we are looking for, I had to create a field in HS called Training credit, a HS list to hold those eligible using the criteria of that field having a value, and create an endpoint that will do the following:

  • Erase everyone from that list
  • Populate that list with users who meet the criteria (this is done by a SOQL query and then adds each to the HS list
  • **To ensure that there aren’t contacts that previously met the criteria (a non-null or empty value) I want to update the HS training credit property field of all contacts by making it empty or null. Doing t his prior to the populate above would probably even mean that I won’t need the erase from list as the updating of the field should handle that.

I hope that makes sense to you.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Update a Contact Property Across All Contacts via API

@whitfty1 Can you tell me more about why you’d need to do this and what you’re using that property for?

You can do this with workflows in the app, byt running all contacts through the workflow:

How can I change a contact property for multiple contacts using workflows?

Learn how to add an action to your workflow to set a new contact property value for all enrolled contacts.

Through the API, there isn’t a single call that would update all contacts to a specific value, so you’d need to update that property for each record individually, preferably using the Batch API.

Create or update a group of contacts | Contacts API

POST /contacts/v1/contact/batch/ - Create a group of contacts or update them if they already exist.

0 Upvotes