Power up with APIs

Roughly a 4 minute read from Neil

24 Jul 2009

For the third time this year we're featured in .NET magazine. This time we've been talking about our experiences with APIs. If you're interested in reading the full article it starts on page 40 of the August edition of .NET magazine.

Web based APIs open up the functionality and data of other applications for anyone to use. Leveraging this functionality from established sources around the web presents the opportunity to enrich the functionality of a website and being able to offer feature X or feature Y from within your app, without having to reinvent the wheel and do it yourself. A simple yet powerful example is the Google maps API. Used all over the world to convey everything from simple 'how to find us' and 'directions' to complex route planning and real time geocoded data display, this API is a great example of how your application can really benefit from tapping into an API. The maps API gives access to what is a complex tool (it utilises satellites, hundreds of cameras, a massive index of places and names and complex maths/algorithms) which if it didn't exist - would mean most current users would not have a solution like they do now and would have to consider writing their own. Which lets face it is not a possibility for most people.

However APIs are increasingly aiding in more than just adding bits of functionality to a site and are being used to provide the very infrastructure that that sites are running on. The Amazon Web Services suite is a great example. Not only can you store all your sites assets (S3) and data (SimpleDB) you can through the use of an API, add more computing power (EC2) to your application that might be struggling under a load of traffic.

The most enjoyable APIs to use are the ones that let you get the most done with the smallest amount of effort! Its nice to have a lot of the work already done for you with some of the common functionality wrapped up in an API call rather than have to make 10 calls to get out what you need. A well designed API is one that knows what the developer will want and puts it right there in front of them and also be accompanied by good documentation.

Most sites normally will offer some type of API these days. Recently we've been working with Mailchimp (emarketing suite) and Google Analytics (web traffic stats) to provide some in depth reporting tools from right inside our CMS product dashboard which means its all there in one place. We can also pick and choose what and how we display it which is a major benefit. You can get some highly customised and useful data from both of these two.

There are obviously problems and drawbacks with API's with one difficulty being that they are all different and therefore each that you work with requires some learning. There are basically three types of API architecture: RESTful, XML based and RESTful/XML hybrids - but there are no rules how each of these are implemented and APIs of the same architectures are often implemented differently. From a design point of view - once you give you cant take away. For example you might think its a good idea in V1 of your API to include access to all user data. But by the time you get to V1.3 you really don't want them to have it anymore. Tough !

Being heavily reliant on someone else's software can have its downsides and sometimes the services we are accessing are down. There are basically two things we can do. The first is to display an error page explaining the service is currently down (it should never just be broken) and the second (if its just data you are relying on and not some clever functionality like Google maps) is to copy the data locally so in the event of a problem you can just switch your data source from API to local database until the API comes back.

Please leave us a comment if you have anything to add.

Hey there old timer!

Our website uses some new fangled technology which we’re afraid your current web browser doesn’t support.

There’s loads of choice out there nowadays and it’s easy to upgrade. Just click the link below for more information!

Upgrade my browser

I.T. guy wont budge?

No problem! Give us a call on 0113 457 4090, we’re happy to help.