APIs & Integrations

Venky1
Teilnehmer/-in

Updating contact property using python API

lösung

Hi 

 

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

https://developers.hubspot.com/docs/api/crm/contactshttps://developers.hubspot.com/docs/api/crm/cont...

 

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

 

Venky1_0-1622656339990.png

 

Error log :

Venky1_1-1622656398363.png

 

0 Upvotes
3 Akzeptierte Lösungen
TiphaineCuisset
Lösung
Community-Manager/-in
Community-Manager/-in

Updating contact property using python API

lösung

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


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


Lösung in ursprünglichem Beitrag anzeigen

MichaelC
Lösung
Ratgeber/-in | Partner
Ratgeber/-in | Partner

Updating contact property using python API

lösung

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

MichaelC_0-1622710253998.png

 

Do that and come back here.

 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

Lösung in ursprünglichem Beitrag anzeigen

webdew
Lösung
Ratgeber/-in | Diamond Partner
Ratgeber/-in | Diamond Partner

Updating contact property using python API

lösung

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 : https://prnt.sc/13two1p
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. 

Lösung in ursprünglichem Beitrag anzeigen

5 Antworten
maulanariziq
Mitglied

Updating contact property using python API

lösung

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.

0 Upvotes
Venky1
Teilnehmer/-in

Updating contact property using python API

lösung

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

webdew
Lösung
Ratgeber/-in | Diamond Partner
Ratgeber/-in | Diamond Partner

Updating contact property using python API

lösung

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 : https://prnt.sc/13two1p
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. 

MichaelC
Lösung
Ratgeber/-in | Partner
Ratgeber/-in | Partner

Updating contact property using python API

lösung

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

MichaelC_0-1622710253998.png

 

Do that and come back here.

 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

TiphaineCuisset
Lösung
Community-Manager/-in
Community-Manager/-in

Updating contact property using python API

lösung

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


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !