APIs & Integrations

cbarnes199
Membro

C# Hubspot Contacts class already built?

Has anyone already built a C# Contacts class to deserialize the api returned json into?

Thanks!

0 Avaliação positiva
5 Respostas 5
matt3
Membro

C# Hubspot Contacts class already built?

Below is the hubspot api response in c# format obtained from json2csharp

public class HubSpotResponse
{
    public string status { get; set; }
    public string message { get; set; }
    public string correlationId { get; set; }
    public List<string> invalidEmails { get; set; }
    public List<FailureMessage> failureMessages { get; set; }
    public string requestId { get; set; }

    public class FailureMessage
    {
        public int index { get; set; }
        public Error error { get; set; }
    }
    public class Error
    {
        public string status { get; set; }
        public string message { get; set; }
    }

}
0 Avaliação positiva
cbarnes199
Membro

C# Hubspot Contacts class already built?

I found this pretty helpful. I could not use the results directly buy they saved a lot of typing.

http://json2csharp.com/

This will generate C# classes off the json and then you just have to do some tweaking out of the names with - in them that are not allowed.

0 Avaliação positiva
tsuser
Membro

C# Hubspot Contacts class already built?

@cbarnes199 Thanks! That sounds good and will definitely check it out.

0 Avaliação positiva
tsuser
Membro

C# Hubspot Contacts class already built?

@pmanca Yes Json.NET is a very good tool but are the .NET object classes for the HubSpot items (ie Contacts) already built somewhere so that we can use Json.NET to serialize/deserialize directly to strongly typed objects - without having to create the required object classes ourselves?
Thanks for your help!

0 Avaliação positiva
3PETE
HubSpot Employee
HubSpot Employee

C# Hubspot Contacts class already built?

@cbarnes199 Hey there is a popular class built out that you can read up on and leverage to do this. It is called Json.NET. Here is a link to the documentation on it. Let me know if this helps or not.
http://www.newtonsoft.com/json

0 Avaliação positiva