Update a property

I tried to update a contact property called Campaign ID and all of the saved ID’s were overwritten by the new update. Is there a way to update properties using the properties API without overwriting them all. I want to add to the dropdown list.

Thanks

Hey @likwid,

I figured I’d chime in on this as I responded to your previous question that I feel is somwhat related. :blush: To confirm, you are hoping to append values to a dropdown property within HubSpot?

If that is the case it’s done using the Properties API. First you must first retrieve the property in question. This is done by making a request like this: GET crm/v3/properties/{objectType}/{propertyName}. This will return an array called “options” in the response, similar to the below. These are the existing options within the dropdown. In this instance “001” and “002”.

GET https://api.hubapi.com/crm/v3/properties/{objectType}/{propertyName}
RESPONSE:
"options": [
 {
 "label": "001",
 "value": "001",
 "displayOrder": 0,
 "hidden": false
 },
 {
 "label": "002",
 "value": "002",
 "displayOrder": 1,
 "hidden": false
 }
 ]

Next, to append new values we make a request like this - notice how we’ve used the options above but also added a new option for “003”.

PATCH https://api.hubapi.com/crm/v3/properties/{objectType}/{propertyName}
BODY:

{
 "options": [
 {
 "label": "001",
 "value": "001"
 },
 {
 "label": "002",
 "value": "002"
 },
 {
 "label": "003",
 "value": "003"
 }
 ]
}

The result is the existing property being updated with the new value. It is expected behaviour that all values would be overwritten if we made a similar request to the above but simply just included “003”.

I hope this helps!

Hi @coldrickjack ,

Thank you for answering all of my questions.

You are correct I am To confirm, hoping to append values to a dropdown property within HubSpot.

The property already exsists with about 200 or so values in the dropdown. I need to be able to append a new value submit by a form using the properties api. The only way to do this is send back all 200 or so plus the new one at the end?

Thanks

Hi @likwid have you found a solution?