Google Reader API
Google Reader is an online feed aggregator with heavy use of JavaScript and pretty quick loading of the latest feed data from around the web. Google's AJAX front-end styles back-end data published in the Atom syndication format. The data technologies powering Google Reader can easily be used and extended by third-party feed aggregators for use in their own applications. I will walk you through the (previously) undocumented Google Reader API.
Update 10:40 p.m.:Jason Shellen, PM of Google Reader, called me to let me know that Google built its feed API first and the Google Reader application second as a demonstration of what could be done with the underlying data. Jason confirmed my documentation below is very accurate and Google plans to release a feed API "soon" and perhaps within the next month! Google Reader engineer Chris Wetherell has also confirmed the API in the comments below.
A reliable feed parser managed by a third party lowers the barrier to entry of new aggregator developers. Google and its team of engineers and server clusters can handle the hard work of understanding feeds in various formats and states of validation, allowing developers to focus on the interaction experience and other differentiating features. You can also retrieve and synchronize feed subscription lists with an established user base that could be in the millions, providing a better experience for users on multiple devices and platforms. Google Reader's "lens" provides only one view of the available data.
Google Reader users are assigned a 20-digit user ID used throughout Google's feed system. No cookies or session IDs are required to access this member-specific data. User-specifc data is accessible using the google.com cookie named "SID."
Feed retrieval
/reader/atom/feed/
Google converts all feed data to Atom regardless of its original publication format. All RSS feed post content appears in the summary
element and unlike the My Yahoo! backend I found no additional metadata about the feed containing full posts but Google does publish content
data where available.
You may request any feed from the Google Reader system using the following URL structure:
You may specify the total number of feed entries to retrieve using the n
parameter. The default number of feed items returned is 20 (n=20).
Google strips off all the data it does not render in Reader. Stripped data includes namespaced data such as Apple iTunes podcast data and Yahoo! Media RSS, additional author data such as e-mail and home URL, and even copyright data.
Subscription list
/reader/atom/user/
[user id]/pref/com.google/subscriptions
Google Reader's feed subscription list contains a user's current feed subscriptions as well as past deleted subscriptions. Each feed is contained in an entry
complete with feed URL, published and updated dates, and user-specific tags, if present. Current subscriptions are categorized as a reading list state. You may request the full list of feeds by setting the complete
to true.
Here is a copy of my Google Reader subscription list with my user ID zeroed out. I am not subscribed to my RSS feed (index.xml) and I have added tags to my Atom feed. Each listed feed contains an author element which appears to be empty regardless of declarations within the original feed. Perhaps Google plans to add some feed claiming services, but its own Google blog has no affiliated author information.
Reading list
/reader/atom/user
[user id]/state/com.google/reading-list
My favorite feature of the Google Reader backend is direct access to a stream of unread entries across all subscribed feeds. Google will output the latest in a "river of news" style data view.
Here is a sample from my limited subscription set. You may specify the total number of entries you would like Google to return using the n
parameter -- the default is 20 (n=20).
Read items only
http://www.google.com/reader/atom/user/
[user ID]/state/com.google/read
You can retrieve a listing of read items from Google Reader. You might want to analyze the last 100 items a user has read to pull out trends or enable complete search and this function may therefore be useful. You may adjust the number of items retrieved using the n
parameter -- the default is 20 (n=20).
Reading list by tag
/reader/atom/user/
[user id]/label/
[tag]
You may also view a list of recently published entries limited to feeds of a certain tag. If you have tagged multiple feeds as "marketing" you might want to request just the latest river of news for those marketing feeds. The returned feed contains both read and unread items. Read items are categorized as read (state/com.google/read
) if you would like to hide them from view. The number of returned results may be adjusted using the n
parameter.
Starred items only
/reader/atom/user
[user id]/state/com.google/starred
Google Reader users can flag an item with a star. These flagged items are exposed as a list of entries with feed URL, tags, and published/updated times included. You may specify the total number of tagged entries to return using the n
parameter -- the default value is 20 (n=20).
Google treats starred items as a special type of tag and the output therefore matches the tag reading list.
Add or delete subscriptions
/reader/api/0/edit-subscription
You may add any feed to your Google Reader list using the Google Reader API via a HTTP post.
/reader/api/0/edit-subscription
-- base URLac=
["subscribe" or "unsubscribe"] -- requested actions=feed%2F
[feed URL] -- your requested subscriptionT=
[command token] -- expiring token issued by Google. Obtain your token at /reader/api/0/token
.
/reader/api/0/edit-tag
You may also add tags to any feed or individual item via a HTTP post.
/reader/api/0/edit-tag
-- base URLs=feed%2F
[feed URL] -- the feed URL you would like to tagi=
[item id] -- the item ID presented in the feed. Optional and used to tag individual items.a=user%2F
[user ID]%2Flabel%2F
[tag] -- requested action. add a tag to the feed, item, or both.a=user%2F
[user ID]%2Fstate%2Fcom.google%2Fstarred
-- flag or star a post.T=
[special scramble] -- three pieces of information about the user to associate with the new tag. Security unknown and therefore unpublished.
Conclusion
It is possible to build a your own feed reader on top of Google's data with targeted server calls. You can power an application both online and offline using Google as your backend and focus on building new experiences on top of the data. Advanced functionality is available with a numeric Google ID and some variable tweaks.
Google has built the first application on top of this data API, the Google Reader lens, and judging from their choice of URLs the lens may not be Google's last application built on this data set. I like the openness of the data calls and think the Google Reader APIs are simple enough to bootstrap a few new applications within Google or created by third-party developers.
content source
Niall Kennedy's Weblog
http://www.niallkennedy.com/