Lip Dub

This Lip-Dub Video looks like a lot of fun, And a great song too.

Leave a comment

The RESTful URL

When creating the train time table service I decided to use a RESTful approach for the API, This meant the URL should confirm to a number of RESTful Principles.

1) The URL represents a resource and consist of NOUNs, not VERBs.
If you using Verbs then you are not using REST. you’re using RPC.
One of the defining principles of REST is the use of a limited set of Verbs POST,GET,PUT and DELETE which correspond to Create, Read, Update and Delete (CRUD).
This allows the easy contruction of URLS so that a consumer and go directly to the resource required.
for example
http://www.eoinprout.com/trains/Cork/Cobh/
will return the Cork Cobh time table resource.

2) The URL hides implementation details.
There are many advantages to hiding the implementation details not the least of which is that it allows the background implementation to be changed without affecting the API.
In my case the service is implemented in PHP but by using mod_rewrite it was possible to hide the implementation details of the service, One more advantage of this is that many search engines do not properly index dynamic pages which require the correct parameters to be set. This aids the discovery of the service.

3) The service should expose other parts of the service via links allowing discovery and traversal.
The trick here is not expose everything in one URL. In the case of my service the user starts at ../trains/ which presents a list of departure stations and links to a list of possible destinations, from there another link will return the URL for the particular time table required. so all the users needs to remeber is the ../trains/ URL.

4) GETs are used for obtaining a copy of the resource.
GET is the standard HTTP method getting content when you type a URL into the address bar of the browser it is a GET which is executed , On IrishRail.Com POSTs are used to retrieve a copy of the time table a user may be looking for.
There are serious disadvantages when using POSTs to retrieve a resource, The resource cannot be bookmarked, The URL for the resource cannot be sent to someone else, URL cannot be constructed and search engines cannot index the resource.

1 Comment

links for 2007-05-21

  • Intel vs OLPC Smackdown. One Looks Like a Toy, the Other Acts Like One.
    When the OLPC was first mooted everybody laughed, They’re not laughing anymore.
    This is a review comparing Intels Classmate and the OLPC.
    (tags: OLPC)
  • Chip-maker Intel “should be ashamed of itself” for efforts to undermine the $100 laptop initiative, according to its founder Nicholas Negroponte.
    (tags: OLPC)
Leave a comment

The RESTful Reading List

REST has been gaining more and more traction lately but there are still a lot misconceptions about it, So that we’re all on the same page I’ve included a list of the articles which I think explain REST.

“How I explained REST to my wife” : An excellent discussion on what makes REST REST.

Common REST mistakes : Sometimes it helps to understand something by understanding what is not.

The RESTful Web at XML.COM : Good articles about REST on O’Reilly.

The Beauty of REST : A nice article on an actual REST implementation by Jon Udell, who is now working for Microsoft as an evangalist. Jon has written a number of articles on the benefits of REST

The REST communities Wiki

And Finally the dissertation which coined the terms

Leave a comment

Irish Rail Train Timetables Service Optimised For Mobile Internet

In one of my previous posts I moaned about the high cost of the mobile internet in Ireland, The site I used as an example was Irishrail.com, I use this site a lot, checking the Cork/Cobh timetables. I wanted to be able to check the train times on my mobile but I wouldn’t use the Irish Rail website when it costs so much to do so. I decided to create a REST style web service optimized for the mobile internet, i.e. use as little bandwidth as possible.
It’s also be a chance to try out some ideas related to REST.

IMHO REST is the way to construct web services.

The Service is available here and you get your timetable by traversing the links.
OR
You can go directly to the timetable you want by constructing the URL based in the Format

http://www.eoinprout.com/trains/DeparturePoint/Destination

For Example
http://www.eoinprout.com/Cobh/Cork/
http://www.eoinprout.com/Cork/Cobh/

The service will show the timetable for trains between your destination and point of departure for the day, bookmarking the timetable will allow you to quickly check “Todays” timetable.
The service returns “Todays” timetables, If I’m planning journeys far in advance I’ll use my PC, The phone is for when I need to check when the next train home is :) . If anyone really wants it changed to support dates in the future just ask.

Of course the first question you ask is, “How much bandwidth does it save ?
It saves a lot.

Irishrail.com eoinprout.com/trains/
Traversing Links 167kb 9kb
Constructing Link Not possible 1kb



It’s not possible to construct the URL for a particular timetable on Irishrail.com because it’s using a POST to send parameters rather then a GET, Interestingly this means that the timetable cannot be bookmarked to allow quick access.

The service was created using PHP and mod_rewrite, which I’ll talk more about in the future as I’m going to be using this service to illustrate REST.

Leave a comment

links for 2007-05-19

Leave a comment

links for 2007-05-18

Leave a comment

links for 2007-05-17

Leave a comment

Tag Clouds and Social Bookmarking

Tag Clouds are a useful way of visualizing information.

When I saw the tag cloud generated by del.icio.us using my bookmarks, I was surprised how clearly I could see myself in it.

It presents a interesting picture of my interests although it is a skewed towards computing related subjects, but being an internet based tool it is only to be expected (or maybe it’s me who is skewed ;) ).

It’s interesting or worrying, I haven’t decided yet which, how much can be deduced about someone just from their social bookmarks.

Leave a comment

Tag Cloud

Leave a comment