Update a Contact Property Across All Contacts via API


#1

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?


#2

@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:

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.


#3

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.