CMS Development

Brownstephen101
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Set Contact Owner with Create or Update API

SOLVE

Hello, does anyone know if it's possible to set the owner of a contact using the Create or Update contact api? I'm not sure if it's a bug, I am creating a contact and company and then associating them, and as part of the payload for each, it checks if there is an owner query parameter and sets the owner if there is. It is working in all regards, but for some reason the owner is not being set on the contact record (it is working for the company).
I logged the data being sent for the contact, it is:

 

 

{"properties":[{"property":"firstname","value":"Stephen"},{"property":"lastname","value":"Brown"},{"property":"email","value":"stephen+test2@impulsecreative.com"},{"property":"company","value":"testfdas"},{"property":"hubspot_owner_id","value":"87349627"}]}

 

 

All properties other than hubspot_owner_id are being set without issue. I should note that there are no errors that are being caught.Any help would be appreciated 

0 Upvotes
1 Accepted solution
Brownstephen101
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Set Contact Owner with Create or Update API

SOLVE

I ended up figuring it out, it was because my email was pulling as undefined in the request_url

`https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/${email}?hapikey=${API_KEY}`

I thought that would throw an error. Surprisingly, it doesn't. It let the function run and even created a new contact with the payload data, but it wouldn't add any properties other than first name, last name, company, and email. 

View solution in original post

3 Replies 3
dennisedson
HubSpot Product Team
HubSpot Product Team

Set Contact Owner with Create or Update API

SOLVE

@Brownstephen101 

I have not tested this on the v1 endpoint that it appears that you are using.  I will in a minute 😀, but

I did just verify that it works when patching via the v3 endpoint

my call (I removed the other properties, but obviously, you can add them back):

https://api.hubapi.com/crm/v3/objects/contacts/58951?hapikey={{hapikey}}

{
    "properties":{
        "hubspot_owner_id": "49773289"
    }
}

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Set Contact Owner with Create or Update API

SOLVE

Follow up -- tested with the v1 endpoint and had no issue there either 🤔

Can you confirm which endpoint you are using and also that the owner id is correct?

0 Upvotes
Brownstephen101
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Set Contact Owner with Create or Update API

SOLVE

I ended up figuring it out, it was because my email was pulling as undefined in the request_url

`https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/${email}?hapikey=${API_KEY}`

I thought that would throw an error. Surprisingly, it doesn't. It let the function run and even created a new contact with the payload data, but it wouldn't add any properties other than first name, last name, company, and email.