C# wrapper for Basecamp API

I’m a keen Basecamp user, and recently wanted to start building some custom functionality based around the API.  Unfortunately, there wasn’t a C# wrapper out there, allowing easy access to the API from within .NET, so I’ve created a simple version to do this.

Download it here: SimpleBasecampApi.zip (17 April 2006)

The solution contains two projects.  A class library project, consisting of one class, BasecampApi.cs, which has only one method, SendRequest(string command, string request).  The command text is always prefixed with a forward slash, eg. /project/list.  The request text is an XML string which is posted with the request, as required by the Basecamp API documentation.

As this was built relatively quickly, there’s no data validation, and very little error checking, so if you use this in production code, these are things you should consider implementing.  However, I am planning to improve on this, so you might want to check back once in a while to see if there have been any updates.

The second project is a sample winforms applications, which allows you to test the API.  It can be used to send requests, and view the XML data sent back.  To avoid the hassle of entering your url, username and password each time, simply modify the app.config file accordingly.

Although this simple API wrapper works relatively well, it still requires manual creation and manipulation of XML data.  I’ve started working on a second, more advanced version, which wraps objects around the XML data, making it much more intuitive to use.  However, there is significant work required in getting this to work properly, and I don’t know if there is enough demand for it to justify the work involved. 

I’ll post a copy up here on my blog when I’ve done a bit more work on it, but in the meantime, if anyone is interested, feel free to get in touch and I’ll send you a copy of what I’ve done so far.

Update – 02 May 2006: There’s a really nice PHP Basecamp API wrapper at QuirkeyBlog.  Haven’t tested it out yet, but reading the documentation, it’s usage is similar how I imagined the improved C# version wrapper working.  Sadly, there wasn’t much (any) feedback on the this post despite numerous downloads, so the job of improving it has taken a back seat, as there appears to be very little demand.

Update – 10 December 2006: It’s good to see someone take this foundation and extend it. Someone has written a much more comprehensive .NET wrapper around the Basecamp API, with proper objects (rather than having to manually craft and parse XML data).  It’s only compatible with .NET 2.0 though, but it seems like a lot of people have started using this for new development work anyway.  This is definitely worth checking out.

[tags]basecamp, api, wrapper, c#, .net, programming, project management[/tags]

This entry was posted in Uncategorized by Mun. Bookmark the permalink.

8 thoughts on “C# wrapper for Basecamp API

  1. Pingback: Mun’s Place : Where Mun talks about stuff » Long weekend over, but it was productive!

  2. Thanks for letting me know, Luke.

    Somehow, some settings got changed, but it’s all fixed now and the download seems to be working again.

  3. Hi There, Just downloaded your Basecamp API wrapper, but it seems to be failing, did a quick search on their forums and it turns out that they have changed their webservers from apache to Lighttpd and it seems to be abit funny with the headers.

    http://www.basecamphq.com/forum/viewtopic.php?pid=11626

    Not sure if you are going to play around with this any more, but htought you might like to know.

    Cheers

    Glyn

  4. Hi,

    Download link not working. We also need to use basecamp API. Pls correct the download link

    thnks
    Baiju

  5. Hi Mun,
    i have one doubt.
    where will we get basecamp command.
    For example for create comment we use
    string cmd = “/msg/create_comment”;
    I also need to create time entry. But not know its exact command. where will we get basecamp commands
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>