API Development

backtake me back
API Development

Application Programming Interface (API)


An API is an application that allows your website interact with third-party applications, such as some of the examples above. API's are a fantastic way to keep your website up-to-date, make them interactive for the user and enrich them with content that would otherwise be unavailable.

Let's run through a few examples. As a member of the Twitter service, you simply want to insert your latest tweet on your website, no problem. You run a social networking website and would like to read/write entries to/from Facebook, or even allow users to login with their Facebook credentials, no problem. You have a contact page and would like users to interact with Googlemaps to identify your exact address and calculate directions right from your website, no problem!

Googlemaps


Here's quite a basic implementation, showing the location of Denny, where I've placed a marker for you. It's simply Googlemaps, right here, in my website. I did not develop Googlemaps, I'm simply using Google's API to allow my website to interact with their well established and popular service.

Or, if you're like me and get over enthusiasic you could log your mobile device's location in a database using Foursquare's API, and then use to display on an interactive map, that features grouping of markers. Yes, perhaps pointless! But it demonstrates the potential to list your local businesses, attractions or statistics etc. The possibilities are endless.

Foursquare


This is very similar to the above, also using Foursquare's API to get my last "check-in", but this time extracting a little more detail, and coupling it with Googlemaps API to display the information on a map. Here is my last known location according to Foursquare.

Sunday 29th Apr 2012, 13:33
The Lion & Unicorn The Lion & Unicorn
Restaurant

Last.fm


Last.fm

Last.fm boasts to be the world's largest online catalogue, but that's not the reason I'm a fan. I'm facinated by Last.fm as they allow you to scrobble the songs you're currently playing, and build a profile for you. I use their API to call back all the tracks I listen to and log them in my database for my own stats and music playground. Please note the "now playing" details have about a 30min delay, as there wasn't the appetite to display what I'm currently listening to live, but possible all the same. And I make no excuses for my music tastes!

Apologies if the album cover on the right doesn't fit correctly, as these are sourced from Last.fm's website.

Artist Linkin Park
Album Hybrid Theory
Track In the End
1 day, 6 hours ago

A music timeline, just for fun...

Google Chart


Google Chart (aka Chart API) is an application I'm starting to use more and more. The real advantage here is the fact you can now place dynamic charts on your website to display data. Gone are the days of having to create graph, save it as an image and then use it to display static data that never changes.

The example opposite simply shows my most popular days for listening to music when I work, according to Last.fm.

Flickr


I've actually already used this API already on my blog pages to provide a simple photostream to my Flickr account, which provides 6 thumbnails of my latest photos uploaded including titles. Here is another demoanother demoanother demoanother demoanother demoanother demo I've changed the requirements a little by asking the API to request a maximum of 15 images, plus I'd like them in a larger format displaying them in a Lightbox.

Weather Underground


Denny
Conditions: Mostly Cloudy
Temperature: 6°C
Humidity: 81%
Wind: From the NE at 10 MPH
Pressure: 29.98 in (1015 mb)
Time: 18th May 2012, 23:50

Again I'm just using Weather Underground's API as a demo to report the local weather in my area, but there other far more important uses this could be put to such as forcasting, weather warnings or even logging historical data for future analysis.

Hottest temp. recorded to date: 25°C (30th Sep 2011, 12:50)
Coldest temp. recorded to date: -16°C (8th Dec 2010, 07:50)

Twitter


And of course there's Twitter. I'm not going to demo the API here as I already do that on my website at the bottom in the footer, but did you know their API also allows you to perform actions such as add, edit and delete your own posts too? This opens the door to all sorts of options such as creating your own social networking website.