About the Contacts category


#1

Questions about the Contacts API, Contact Lists API, and Contact Properties API


#2

Hello,

I use this endpoint: http://developers.hubspot.com/docs/methods/contacts/create_or_update
I’ve created a custom property via the app
When I post the data to the endpoint it always return

data that I sent:
{ "properties": [ { 'property': 'email', 'value': user.email }, { 'property': 'firstname', 'value': user.first_name }, { 'property': 'lastname', 'value': user.last_name }, { 'property': 'company', 'value': user.company.name }, { 'property': 'language', 'value': user.locale.blank? ? 'en' : user.locale }, { 'property': 'new_company_id', 'value': user.company_id }, { 'property': 'gender', 'value': user.gender }, { 'property': 'jobtitle', 'value': user.position } ] }

"status"=>"error", "message"=>"Property values were not valid", "correlationId"=>"00000000000000", "validationResults"=> [{"isValid"=>false, "message"=>"Property \"language\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"language"}, {"isValid"=>false, "message"=>"Property \"new_company_id\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"new_company_id"}, {"isValid"=>false, "message"=>"Property \"gender\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"gender"}], "requestId"=>"00000000000000000"}

Those fields are added in hubspot. What else I have to do?

regards


#4

@claudiug

Sorry no one saw this, in the future please open a new post to avoid getting lost!

There is no property in your portal with an internal value new_company_id, I’m assuming you did that to obfuscate your company info, but just wanted to be sure.

I was able to POST the following payload successfully:

POST contacts/v1/contact/createOrUpdate/email/noreply@hubspot.com?portalId=<HID>

{"properties":[
  {"property":"email","value":"noreply@hubspot.com"},
  {"property":"firstname","value":"hubspot"},
  {"property":"lastname","value":"support"},
  {"property":"company","value":"hubspot"},
  {"property":"language","value":"en"},
  {"property":"new_company_id","value":"test2"},
  {"property":"gender","value":"male"},
  {"property":"jobtitle","value":"support"}
]}

Note: The internal value new_company_id is not valid and should be changed to match the internal value in your portal.

Please make sure that you are including the {"Content-type" : "application/json"} header.

Sebastian


Custom properties and API
#5

Hello,

Thx for the reply. When I do the post, all submit {"Content-type" : "application/json"} in header.
Also, new_company_id is created by us. So is possible to use custom properties created by us?

regards,

Claudiu


#6

@claudiug
You can definitely create custom properties, but there isn’t currently a property in your portal with that name unless I’m looking at the wrong portal.


#7

Hi there

this is the hash that I’m trying to post. All the properties are in our contacts data
{:properties=> [{:property=>"email", :value=>"claudiu.garba@gmail.com"}, {:property=>"firstname", :value=>"Ollie"}, {:property=>"lastname", :value=>"Pesto"}, {:property=>"company", :value=>"Jimmy Pesto Pizza"}, {:property=>"language", :value=>"en"}, {:property=>"new_ecratum_company_id", :value=>3}, {:property=>"gender", :value=>nil}, {:property=>"jobtitle", :value=>nil}]}

and this is the result from the call
{"status"=>"error", "message"=>"Property values were not valid", "correlationId"=>"84dff80b-49dc-4cbb-bb9a-28d60e81001c", "validationResults"=> [{"isValid"=>false, "message"=>"Property \"language\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"language"}, {"isValid"=>false, "message"=>"Property \"new_ecratum_company_id\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"new_ecratum_company_id"}, {"isValid"=>false, "message"=>"Property \"gender\" does not exist", "error"=>"PROPERTY_DOESNT_EXIST", "name"=>"gender"}], "requestId"=>"eccd1766-1f71-443a-b745-40cf66d1d227"}

Any help?