Documenting Picasa

Providing documentation on Picasa and Picasa Web Albums - photo organization software and services from Google.

Thursday, May 17, 2007

Searching Picasa Web Albums community photos via the API

I noticed that searching community photos at Picasa Web Albums now acts rather differently than it used to - your search returns quickly - but there are no photos shown, then later (sometimes several seconds later) the thumbnail results appear.

What this suggested to me was that the search page was returning the HTML framework, but that the actual search results were being obtained by a separate data query.  That is indeed the case - Google have added searching to the Picasa Web Albums GData API, though there is no mention of this fact yet in the Picasa Web Albums Data API Reference.

The URL for a search query is of the form:

http://picasaweb.google.com/data/feed/api/search?q=google&start-index=1&max-results=24&psc=G&category=photo&alt=json

So the parameters are

  • q : the string to search for
  • start-index : where the lowest number used is 1
  • max-results : the number of results wanted
  • psc=G : this makes it a Global search of all the community photos
  • category=photo : not sure what other values can be used here
  • alt=json : returns the data as json format

Other formats are possible

  • alt=rss : to get the query results as an RSS feed
  • alt=json&callback=output : to get JSON wrapped in a callback function

Unfortunately the results are not as controllable as you really need.  There does not appear to be a way to sort the results, so you simply get them sorted presumably by "relevance" - for an RSS feed you probably want to sort by most recent first, and perhaps to restrict the results to certain date ranges.

Warning: This API is not yet documented though is in use by the Picasa Web Albums pages, and is currently very slow (the very slowness of it was the reason that I spotted that Picasa Web Albums pages had changed the way they worked).  It is very likely that Google will be improving this API before they get around to documenting it, so currently use it at your own risk.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home