Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

37signals Highrise .NET (c#) API [closed]

Tags:

c#

api

highrise

I am looking for a .NET (c#) wrapper for the 37signals Highrise REST API. Sadly enough, I could not find anything really suitable. Has anyone developed something like this or has links to share?

like image 761
twomm Avatar asked Apr 13 '11 14:04

twomm


2 Answers

Use RestSharp - http://restsharp.org/

like image 95
Matt Roberts Avatar answered Sep 21 '22 08:09

Matt Roberts


As some have suggested, RestSharp is pretty easy to use with the HighRise API. At least one person suggested using xsd.exe which I strongly suggest against -- this will complicate things too much. Instead, create a POCO type with just the items you want to get/set. Like this:

namespace Highrise.Model
{
    public class Person
    {
        [XmlElement("author-id")]
        public string AuthorId
        {
            get;
            set;
        }


        [XmlElement("background")]
        public string Background
        {
            get;
            set;
        }

        [XmlElement("first-name")]
        public string FirstName
        {
            get;
            set;
        }

        [XmlElement("last-name")]
        public string LastName
        {
            get;
            set;
        }

        [XmlElement("id")]
        public string Id
        {
            get;
            set;
        }

    }

    public class People : List<Person>{}
}

Then, just do a get using the RestSharp library like this:

//  Setup our client:
var client = new RestClient("https://yourhighrisename.highrisehq.com");
client.Authenticator = new HttpBasicAuthenticator("YOUR_API_KEY_HERE", "X");

//  Create our request:
var request = new RestRequest("/people.xml", Method.GET);

//  Execute our request with our client:
RestResponse<People> response = (RestResponse<People>) client.Execute<People>(request);
like image 4
Dan Esparza Avatar answered Sep 22 '22 08:09

Dan Esparza