Foursquare.NET: Check-ins Made Easy by Brandon Fisch

Foursquare is a new and rapidly growing social utility whose potential for mash-ups with other applications is limited only by one’s own imagination.  Foursquare provides an API for developers which can return either XML or JSON (the latter of which is recommended at this time for future migration to version two of the API).   While .NET provides adequate methods for reading XML or deserializing JSON, working directly with objects best lends itself to rapid development.  This being said, I took it upon myself to develop a .NET wrapper for the Foursquare API.

Foursquare’s API requires a developer to make HTTP requests to a specified URLs passing along a required and optional parameters as necessary to complete a given task such as registering a Check-In for a user.  Developers also need to handle any possible errors that may occur, such as Forsquare’s server timing out (which happens quite often), or Foursquare rejecting a passed parameter.  Results of the requests (whether intended, or errors) must then be parsed to become useable to the developer.  My wrapper for Foursquare’s API internalizes all of this, making Foursquare development in .NET a relatively trivial process.

To use my wrapper, aptly named Foursquare.NET, a developer  simply needs to instantiate an object, set the values of the parameters he would like to pass, and finally call the execute method.  The object returned contains all the information Foursquare provides for that call.

Here is an example of Foursquare.NET in action:
var history = new FoursquareNET.Checkins.History();
history.Limit = 1;
var historyResult = history.Execute(new FoursquareNET.Credential(phone, password));

And the final falue of historyResult is a list of Checkin objects:

foursquare .NET api screenshot

By using Foursquare.NET, developers no longer need to deal with the hassle of using primitive HTTP requests and parsing their results; they can now concentrate on developing innovative and unique Foursquare-integrated applications.

  • Share/Bookmark

Tags: , , , , ,

One Response to “Foursquare.NET: Check-ins Made Easy”

  1. [...] Enter Brandon Fisch, social development rockstar. As a .NET developer, Brandon first had to develop a code library that would allow the .NET platform to play nice with Foursquare’s API. Once that was taken care [...]

Leave a Reply