Google announces new AJAX Feed API

The Google AJAX API team has announced a genuinely useful Feed API that gives an Ajax developer the ability to access feeds, cached in the fast Google edge cache where appropriate, from across the web using a simple JavaScript API. This is a subtle service that does one thing that is currently a pain-point for […]

The Google AJAX API team has announced a genuinely useful Feed API that gives an Ajax developer the ability to access feeds, cached in the fast Google edge cache where appropriate, from across the web using a simple JavaScript API.

This is a subtle service that does one thing that is currently a pain-point for developers of certain applications. Ajax developers now have a clean way to access public feeds on any domain, and get access to the content in a uniform way.

Gone is the need for us to create a proxy on the server to access feeds from other domains.

Gone is the need to have to deal with all of the feed types. RSS, Atom, RDF, we can now use either MIXED_FORMAT or JSON_FORMAT to use the uniform access. The full set of feed formats supported is Atom 1.0, Atom 0.3, RSS 2.0, RSS 1.0, RSS 0.94, RSS 0.93, RSS 0.92, RSS 0.91, RSS 0.9. The unified feed result elements are: title, link, description, author and a list of entries[]. The entries[] list has the following elements: title, link, content, contentSnippet, publishDate, and categories.

XML and mixed formats allow you to also get access to the XML document itself, and then you can use standard DOM tactics to get what you want from that content (e.g. getElementsByTagName). You would want to use XML if you needed to grab out something specific from the feed, such as the digg:count.

RSSBling Redone

Funny story. Ben and I created Ajaxian.com as a place to host RSS Bling back in 2005, as you can see via the Wayback Machine. It was only later that we started the blog.

RSS Bling was an offline RSS reader that we create as an example of doing offline and Ajax before it was cool. We got a lot of mileage out of doing presentations and unplugging the net and seeing that it still worked.

One of our problems was getting access to feeds. We could have created a proxy to feeds, but instead we used bloglines as the proxy, and got the data from there.

With the new Feed API we can go directly to the feeds itself. We ported RSS Bling to use the API, and you can view it here.

Once you load the Feed API, you can grab a feed using google.feeds.Feed, passing in the feed URL, setting any values on it (e.g. the mode to use, how many entries you want in the result size, etc.), and then calling load(callback). The callback allows the API to grab the feed asynchronously, and holds the result itself.

Source:? ajaxian

Google, Ajax, Feed, API, Ajax Feed API, Announcement