API to Update Custom Properties?

contacts

#1

https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/dave.nash@mail.com/?hapikey=MyKey?property=nps_flag

{
"properties":
[
{"property": "firstname", "value": "Dave" },
{"property": "lastname","value": "Nash"},
{"property": "jobtitle","value": "Web Sys Manager"},
{"property": "company","value": "ERIKS"},
{"property": "website","value": "https://eriks.co.uk"},
{"property": "phone","value": "+44 1246 245720"},
{"property": "address","value": "Wharf Lane"},
{"property": "state","value": "Derbyshire"},
{"property": "zip","value": "S43 7NB"}
{"property": "nps_flag","value": "True"}
]
}

I'm attempting to get my contact on Hubspot to update nps_flag with the value True, however the custom properties don't update, any ideas why?

I've posted on other threads but I'm not getting answers :frowning:

My email has been changed to protect the innocent

Any help at all would be great!


#2

Hi @dnash,

What type of property is the nps_flag property? When updating enumeration or single checkbox contact properties, your value must exactly match the internal property values. If nps_flag is a single checkbox, the internal value for true is all lowercase (i.e. true). Can you try your request again with the lowercase property value?


#3

The value is a text entry and can contain anything, I've changed it to true to see if that fixers just in case, but still no joy.


#5

Hi @dnash,

Can you give me your Hub ID so that I can take a look at the property?


#6

Hi Sorry for the delay :
340621


#7

The URL I used was with my correct email!!


#8

@Derek_Gervais Any news on this one pal?


#9

Hi @dnash,

Apologies for the delay here. I was able to make a request using a very similar request:

POST https://api.hubapi/com/contacts/v1/contact/createOrUpdate/email/dgervais@hubspot.com/
{
"properties":
  [
    {"property": "firstname", "value": "Derek" },
    {"property": "lastname","value": "Gervais"},
    {"property": "nps_flag","value": "True"}
  ]
}

You can see the resulting contact record (with the nps_flag property correctly set) below. It looks like you were missing a comma right before the nps_flag property in your request body; is it possible that was affecting your requests?
https://app.hubspot.com/contacts/340621/contact/154675242/properties?search=nps


#10

@Derek_Gervais,

So this code still isn't working and I can't understand why? I've added the comma and it's made no difference, I've also removed the other fields thinking they may have caused an issue.

https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/dave.nash72@gmail.com/?hapikey={my HPI Key Here}?property=nps_flag

{"properties": [{"property": "firstname", "value": "Dave" },{"property": "lastname","value": "Nash"},{"property": "nps_flag","value": "true"}]}


#11

@Derek_Gervais & @mhammed

I've no idea why but the property=nps_flag was stopping the update.
I'll try adding in the extra details.

Best Regards

Dave