Updating contact property using python API

Hi

I am using the v3 API documentation to update a contact property:

The example works for typical field like email, firstname, company etc.

However, I want to change the persona property and it throws invalid property error

Error log :

Hi @Venky1

Thank you for reaching out

I want to tag some of our experts on this - @Bryantworks @MichaelC do you have any thoughts for @Venky1 on this?

Thank you

Best

Tiphaine

@TitiCuisset thanks for the handoff

@Venky1 there is a few things we need to find out..

The error is that the property persona does not exist.. there are several possible errors that might have caused it.

1. Please go to your portal settings > Properties > Contact Properties > Find the property persona

We need to make sure you are using the propertys internal value

My example:

Do that and come back here.

Hi @Venky1 ,
Your code are correct and make sure “persona” properties key should be match with the same or exist in properties. please search property and check key of that.
1. Go To Settings : Screenshot by Lightshot
2. Properties
3. Search persona properties.
4. Check key of persona property and if you property has dropdown values then please check key of options and you have to passed those values.
Note : make sure this properties not a read only property.
import requests
url = “https://api.hubapi.com/crm/v3/objects/contacts/51”
querystring = {“hapikey”:hapikEY}
payload = “{\“properties\”:{\“persona\”:\“New persona\”}}”
headers = {
‘accept’: “application/json”,
‘content-type’: “application/json”
}
response = requests.request(“PATCH”, url, data=payload, headers=headers, params=querystring)
print(response.text)

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

Thanks for the responses. I changed the property values and used the INTERNAL VALUE and INTERNAL NAME instead. It fixed the issue.

I am interested with this topic. But, how if we want to update more than 1 properties?. Do you have format payload if the property more than 1? Thanks.