Google Reader finally has its first official API. Any developer in the world can request the entire history of a web feed from Google’s geo-distributed server cloud in a normalized response for inclusion in their websites or products. I’ve been hoping for such an API since I first deconstructed the Google Reader backend in December 2005.

Most users will likely interact with the Google AJAX Feed API through a JavaScript library included on their site or a pre-configured badge generated on the Google site. The Feed API wrapper is part of a larger effort by Google to extend its search and advertising network onto more sites. Page authors can integrate slick-looking results from Google’s web search, news search, blog search, local search, and video properties.

Google HTTP response waterfall

It’s possible to route around the pre-configured JavaScript API libraries and program directly against the JSON and XML response from Google’s servers. Advanced users can code directly against the service inside of client-side JavaScript or stand-alone programs to optimize user experience and efficiency with 3 less HTTP requests, 5 KB less data transferred over the wire, resulting in about a half-second performance improvement per page load in my test. Here’s how.

Google AJAX Feed API endpoint

It’s much quicker and simpler for advanced users to directly code against Google’s feed API endpoint. I’ll walk through each required and optional parameter of the REST interface.

An example request for my Atom feed.
Base URL.
A properly escaped feed URL.
Define a JavaScript callback function for client-side processing of JSON results. Set to blank for requests from your server.
DOM Level 1 document context for XML. Set to blank if not needed.
json, xml, or mixed. The JSON response is the JavaScript wrapper’s default and therefore most likely to be already cached for common feeds.
API version number, currently 1.0.
Optional. Maximum number of entries included in the response. Default is 4.
Optional. Lets Google track your requests for metering and other purposes. You can agree to a terms of service and receive a key if you’d like.

This endpoint is unsupported and technically in violation of the product’s terms of service. Yet it functions just fine for my needs and provides a quicker load for client- and server-side scripts.