HubSpot.NET icon indicating copy to clipboard operation
HubSpot.NET copied to clipboard

Unable to Create Contacts "Property properties doesn't exist".

Open axyl opened this issue 5 years ago • 19 comments

This is for the v1-preview branch...

When trying to create (or CreateorUpdate) I'm getting an error back from the REST response saying "Property \"properties\" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"properties"}],"status":"error","message":"Property values were not valid"...

It looks like the properties data member is being included for the Contact when sending off the JSON.

axyl avatar Jun 21 '19 01:06 axyl

Hey @axyl! Thanks for bringing this up. Would you be able to post a safe copy of the payload you're sending? Thank you!

Psypher9 avatar Jun 21 '19 02:06 Psypher9

Sample call... var contact = api.Contact.Create(new ContactHubSpotModel() { Email = "[email protected]", FirstName = "Terry", LastName = "Terrence", Address= "10 Something Street", City= "Heresville", ZipCode= "2022", State= "NSW", Phone = "02 8832 2213", });

Which produces... (in the NewtonsoftResetSharpSerializer)

{"properties":[{"property":"email","value":"[email protected]"},{"property":"firstname","value":"Terry"},{"property":"lastname","value":"Terrence"},{"property":"phone","value":"02 8832 2213"},{"property":"address","value":"10 Something Street"},{"property":"city","value":"Heresville"},{"property":"state","value":"NSW"},{"property":"zip","value":"2022"},{"property":"properties","value":"System.Collections.Generic.Dictionary2[System.String,HubSpot.NET.Api.Contact.Dto.ContactProperty]"}]}`

Removing the DataMember from the ContractHubSpotModel.Properties property then obviously removes that property from the generated json....which then works. I haven't applied any brainpower to working out why you might be trying to include that in the payload.

axyl avatar Jun 21 '19 03:06 axyl

Thank you for posting that! For the Create, Update and CreateOrUpdate endpoints the POST body is supposed to only contain an array of property value pairs, see here for more details.

However since it looks like we're complying with the API spec, I'd need to look closer at this to see why that might be happening.

Psypher9 avatar Jun 21 '19 03:06 Psypher9

Snap. I just saw what you're talking about!

Sorry. I know exactly what caused that. I've been working on centralizing the 'NameValuePair' , 'PropertyValuePair' collection creation and I probably introduced that because I'm relying on reflection.

Sorry again for my initial misunderstanding. I've been reading this from my phone. Thanks for catching this!

Psypher9 avatar Jun 21 '19 03:06 Psypher9

Any updates? It looks like ToPropertyTransportModel is not catching the 'properties' dictionary.

I have 'quick fixed' this like this but there are better solutions for sure:

                else if (prop.PropertyType.IsGenericType && value is IDictionary<string, ContactProperty> pairs1)
                {
                    foreach (var item in pairs1)
                    {
                        Properties.Add(new PropertyValuePair(item.Key, item.Value.Value.ToString()));
                    }
                    continue;
                }

MischaWeerwag avatar Jan 14 '20 00:01 MischaWeerwag

I am on HubSpot.NET 0.8.13.0 doing Contact Create and I am getting this... Error: HubSpot.NET.Core.HubSpotException: Error from HubSpot, Response = {"validationResults":[{"isValid":false,"message":"Property "properties" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"properties"}],"status":"error","message":"Property values were not valid","correlationId":"480e8d32-775a-47c7-94f7-b957d856b8f3","requestId":"16aaf6312a430bcf237b108ccea8c468"}

Please advise how to get around the error or what version to switch to that works!

ContactHubSpotModel contact = HsAPI.Contact.Create(new ContactHubSpotModel() { Email = bcCart.Email, FirstName = bcCustomer.FirstName, LastName = bcCustomer.LastName, Phone = bcCustomer.Phone, Company = "x" });

ricktiger avatar Apr 22 '20 20:04 ricktiger

If I get a moment this week, I will try to look back at this. Sorry that you're still having issues @ricktiger. I know where the issue is, I've just not had a moment to patch it yet.

Psypher9 avatar Apr 27 '20 04:04 Psypher9

We downloaded 0.6.17 source code and added it to our Solution and that version seems to be working for us. Thank you.

RickTiger

From: Turner Bass [mailto:[email protected]] Sent: Sunday, April 26, 2020 10:37 PM To: hubspot-net/HubSpot.NET Cc: Rick Tiger; Mention Subject: Re: [hubspot-net/HubSpot.NET] Unable to Create Contacts "Property properties doesn't exist". (#50)

@ricktiger https://github.com/ricktiger Are you using 0.8.1.3 or building from the v1-preview branch?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hubspot-net/HubSpot.NET/issues/50#issuecomment-619711022 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXMSMLH2FDCGWFSNIW5PJTROUDVRANCNFSM4H2GKSDQ . https://github.com/notifications/beacon/AKXMSMNBFRMOLCOUSH42OHTROUDVRA5CNFSM4H2GKSD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOETYAULQ.gif

ricktiger avatar Apr 27 '20 13:04 ricktiger

Thanks, I got past that issue.

Any chance you could please help with this question?

How would I connect deal with contact using the HubSpot.NET wrapper?

Right now my Deal.Create code using HubSpot.NET looks like this...

DealHubSpotModel deal = HsAPI.Deal.Create(new DealHubSpotModel() { Name = arHdr[i].ArInvoiceHistoryDetails[d].ItemCodeDesc, Sku = arHdr[i].ArInvoiceHistoryDetails[d].ItemCode, Amount = Convert.ToDouble(arHdr[i].ArInvoiceHistoryDetails[d].ExtensionAmt), ProductId = arHdr[i].ArInvoiceHistoryDetails[d].ItemCode });

And I want to add the Contact Vid so it links to the HsAPI.Deal.Create.

Thanks Much!

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

ricktiger avatar May 04 '20 18:05 ricktiger

var contact = api.Contact.Create(new ContactHubSpotModel() { Email = emailAddress, FirstName = firstName, LastName = lastName, Phone = phone });

Is it only possible to add the standard properties using this wrapper? I have some custom properties that I would need to add

odowdbrendan avatar May 11 '20 19:05 odowdbrendan

Yes, you can add custom properties in HubSpot, but you also have to add them to the appropriate model file in HubSpot.NET. Then code for them. Property names with spaces become property names with underscores. Good luck!

ricktiger avatar May 12 '20 02:05 ricktiger

Add your new custom Contact properties that you added via HubSpot to this file ContactHubSpotModel.cs. Property names with spaces become property names with underscores.

ricktiger avatar May 12 '20 14:05 ricktiger

If I get a moment this week, I will try to look back at this. Sorry that you're still having issues @ricktiger. I know where the issue is, I've just not had a moment to patch it yet.

The current master branch seems to still have this bug. If you could point me in the right direction, I can probably fix the issue?

JesseKlaasse avatar Jul 13 '20 14:07 JesseKlaasse

I was testing the changes and now receive the error of "json node is missing child properties" when creating a new contact. Any ideas? The JSON in the developer portal is: Post: /contacts/v1/contact Request: [{"property":"email","value":"[email protected]"}]

coustack avatar Jul 20 '20 16:07 coustack

Eventually I gave up, and I have created an own package based on HubSpot.NET, but then for the v3 version of the API, and with async/await support: https://github.com/IndiciaConnectivity/Indicia.HubSpot/

JesseKlaasse avatar Aug 10 '20 13:08 JesseKlaasse

Eventually I gave up, and I have created an own package based on HubSpot.NET, but then for the v3 version of the API, and with async/await support: https://github.com/IndiciaConnectivity/Indicia.HubSpot/

@JesseKlaasse were you thinking of putting a license on your Indicia.Hubspot project? I would be interested in using it. Thanks.

bburrell avatar Aug 17 '20 09:08 bburrell

@bburrell I have added a MIT license, so please go ahead and use it.

JesseKlaasse avatar Aug 17 '20 09:08 JesseKlaasse

Thanks @JesseKlaasse that is awesome!

bburrell avatar Aug 17 '20 09:08 bburrell

@JesseKlaasse I'm currently using your library and I miss the ability to use the constructor of HubSpotApi like in HubSpot.NET or with some method of IHubSpotApi to authorize with ApiKey or OAuth credentials on the fly, not on startup. I will be really grateful if you consider adding it to your library. Thank you!

VladMstv avatar Oct 18 '20 00:10 VladMstv