Open axyl opened 5 years ago
Hey @axyl! Thanks for bringing this up. Would you be able to post a safe copy of the payload you're sending? Thank you!
Sample call...
var contact = api.Contact.Create(new ContactHubSpotModel() { Email = "john@gmail.com", 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":"john@gmail.com"},{"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.Dictionary
2[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.
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.
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!
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;
}
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" });
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.
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:notifications@github.com] 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
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
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
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!
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.
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?
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":"johnSmith@person.com"}]
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/
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 I have added a MIT license, so please go ahead and use it.
Thanks @JesseKlaasse that is awesome!
@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!
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.