Lazy Evaluation

Marina's coding (mis)adventures
The Google Data query interface

I know I'm not the only one with tons of my data stored somewhere on Google's servers these days (frightening, I know.)  Luckily, there's the Google Data API, which lets us access and modify our Google data programmatically, should we decide to, say, display it on our websites or build custom applications to process it.

The API uses HTTP requests to transfer data, building on top of RSS and Atom the ability to send a query and receive a feed of matching results.  This is cool, because it means we can access our data easily, just by creating the appropriate HTTP query.  Here's what I mean:

This is the XML feed of our SRT Events Google Calendar:  http://www.google.com/calendar/feeds/v2433p4md2226qtd3ja1annifc%40group.calendar.google.com/public/basic 

 We can add query parameters to the end of this URL:  http://www.google.com/calendar/feeds/v2433p4md2226qtd3ja1annifc%40group.calendar.google.com/public/basic?max-results=10&orderby=starttime

That new-and-improved feed is the full calendar feed of events, filtered to leave only 10 results and ordered by the start date of the event.  Note that in addition to a standard set of parameters for all Google Data, there are some special ones defined for each app, like "racy" in YouTube.   

Here's the metadata for the most-viewed YouTube videos:

http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed

and adding these query parameters gives us just the family-friendly ones, ordered by rating.

http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?orderby=rating&racy=exclude

 


Now that we've got these custom feeds, we can just use any standard libraries to parse or display them. Pretty cool.

  

Published Saturday, March 29, 2008 8:01 PM by mfedner

Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)