Google Feed API

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.

http://www.google.com/uds/Gfeeds
Base URL.
q
A properly escaped feed URL.
callback
Define a JavaScript callback function for client-side processing of JSON results. Set to blank for requests from your server.
context
DOM Level 1 document context for XML. Set to blank if not needed.
output
json, xml, or mixed. The JSON response is the JavaScript wrapper’s default and therefore most likely to be already cached for common feeds.
v
API version number, currently 1.0.
num
Optional. Maximum number of entries included in the response. Default is 4.
key
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.

9 comments

Commentary on "Google Feed API":

  1. Paul Stamatiou on wrote:

    Just as a minor correction, you have the abbr title for HTTP as “Hypertext Markup Language” . I think you meant “Hypertext Transfer Protocol”.

    • Niall Kennedy on wrote:

      Thanks Paul, fixed. My brain went into autocomplete a bit too quickly on that one.

  2. Nik Cubrilovic on wrote:

    Google aren’t really known for redundant code and there is a good reason why they abstract their API’s in this way, primarily because they can extend or change parameters, return values, queries etc. without it affecting the user or prior implementations. Rule of thumb should always be to use the API like it is intended and appreciate it.

  3. Andy Edmonds on wrote:

    Very cool! Here’s a mashup with windows live providing a feed list and Google providing posts… GLive Reader

    Is there a way to use Google APIs to get feeds?

  4. Andy Edmonds on wrote:

    Answer to “Anyway to get feeds from google apis?”: Yes.

    filetype:rss in web search

  5. Ori Lahav on wrote:

    anyone know if there is a way to supply post permalink and get the post data?

    • Edwin Khodabakchian on wrote:

      Ori,
      I am running against the same question. Were you able to look up a specific entry using a URL or an item id?
      Thank you,
      Edwin

  6. Tyler on wrote:

    Do you now how far back you can access the Google RSS cache? I hit different limits on each cache (40-50 usually) which is far, far less than what Google has cached as evidenced by Google Reader.

  7. Jay C. on wrote:

    Just thought I’d point out that in fact you can “directly code against Google’s feed API endpoint” without violating the product’s terms of service.

    From http://code.google.com/apis/ajaxfeeds/documentation/:

    For Flash developers, and those developers that have a need to access the AJAX Feed API from other non-JavaScript environments, the API exposes a simple RESTful interface. In all cases, the method supported is GET and the response format is a JSON encoded result with embedded status codes.