Thursday, April 27, 2006

Why GET should always be idempotent: A lesson from Del.icio.us and Sage

This evening I downloaded Sage, a RSS/Atom feed reader extension for Firefox. It is quite a nice feed reader and a big improvement over Firefox's Live Bookmarks which I find hard to use with lots of feeds and IMO over Google's Personalised Homepage which I find doesn't scale too well with lots of feeds and doesn't provide previews of the content.

Sage had a particularly cool feature that jumped out at me, the 'Discover Feeds' feature. This allows you to find all the feeds referenced in a page, rather than just the feed in a link tag in the header. It seems that what it does is follow links that may be potential feeds and checks if they are. You then get a list of all the feeds in the page and can add them to your 'watched' feeds in Sage.

This got me thinking, since I use alot of different computers it is pain trying to manage my list of feeds on each computer, exporting them and copying them around is just asking to get them out of sync and frankly too much effort. ;) So since I already have a Del.icio.us account where I keep my bookmarks I could bookmark all the feeds I care about and tag them with 'feed' in Del.icio.us. Then I just need to navigate to the page for the 'feed' tag click on the Discover Feeds button in Sage and all my bookmarked feeds are there to be added to Sage! Yay online storage of feed links that can easily be added to my feed reader of choice from any computer!!!

Or so I thought. It just so happens that the Delicious 'Delete Bookmark' link is one of the links that Sage follows when it searches for feeds. This has the unfortunate side effect of deleting all my bookmarks in the feed tag. The ideal fix is that Delicious delete action needs to be changed to only respond to a HTTP POST method. This would be comformant with W3C Recommandations too.

I've submitted this bug to Delicious but for now the dream of online bookmarking of feeds to be accessed by Sage remains elusive.

Tags:

Sunday, April 23, 2006

Calling Web Services From Rails

I've notice a few places where people have asked whether Ruby On Rails supports the consumption of web services. Rails itself doesn't. I have found the easiest thing to use is SOAP4R, which according to its web page comes bundled with Ruby 1.8.3 and above.

SOAP4R is really easy to use, it simply generates Ruby stubs from a WSDL which will call the web service for you. You just call the stubs as though they were a Ruby API.

If you have ever used any Java or .NET web service clients, it is pretty much the exact same concept.

Tags: