Picasa Web Albums allows client applications to view and update albums, photos, and comments in the form of Google Data API feeds. Your client application can use the Picasa Web Albums Data API to create new albums, upload photos, add comments, edit or delete existing albums, photos, and comments, and query for items that match particular criteria.
This document is intended for programmers who want to write client applications that can interact with Picasa Web Albums. It provides a series of examples of basic Data API interactions using raw XML/HTTP, with explanations. After reading this document, you can learn more about interacting with the API using our client libraries by reading the language-specific examples found on the other sections of this document.
For Picasa Web Albums Data API reference information, see the reference guide.
This document assumes that you understand the general ideas behind the Google Data APIs protocol. Each example in this document first shows how to use the bare protocol to interact with Picasa Web Albums.
You may want to sign up for a Picasa Web Albums account for testing purposes.
To request or upload documents, your client needs an authentication token. The following sections explain how to authenticate for different types of client applications.
Your choice of authentication method should be determined by the kind of client you're writing: single-user desktop applications should use the ClientLogin system, while multi-user web apps should use the AuthSub system. For a more detailed discussion of these authentication systems, see the Google Account Authentication document.
Whichever method you choose, you can either send raw HTTP requests or have Google's client libraries handle the authentication for you.
To authenticate the user, send a POST request to the following URL:
https://www.google.com/accounts/ClientLogin
Include the relevant parameters in the body of the POST request, as described in the ClientLogin documentation. The service name for Picasa Web Albums is lh2.
If the request succeeds, then the response contains an alphanumeric string labeled Auth.
After a successful authentication request, use the Auth value to create an Authorization header for each request:
Authorization: GoogleLogin auth=yourAuthValue
To acquire an AuthSub token for a given Picasa Web Albums user, your application must redirect the user to the AuthSubRequest URL at Google, which prompts them to log into their Google account.
After the user logs in, the AuthSub system redirects them to the URL you specified in the next query parameter of the AuthSubRequest URL. The AuthSub system appends an authentication token to the next URL as the value of the token query parameter. Your application then uses that authentication token in subsequent interactions with Picasa Web Albums.
The below example shows a request to authorize www.example.com:
https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2F&session=1&secure=0&next=http%3A%2F%2Fwww.example.com%2Fwelcome.pyc
The important part to note above is that the scope of the AuthSub token for all of the Picasa Web Albums feeds is:
http://picasaweb.google.com/data/
By default, the AuthSub token can only be used for one request. To receive a token which can be used for multiple requests, it must be upgraded
by making an HTTP GET request which contains the single use token as an Authorization header. A token may only be upgraded if the initial AuthSub request included session=1 as a URL parameter.
GET https://www.google.com/accounts/accounts/AuthSubSessionToken Authorization: AuthSub token="yourAuthToken"
If the token was upgraded successfully, the server's response contains the new token information in the HTTP headers. Here's an example response:
Token=DQAA...7DCTN Expiration=20061004T123456Z
You can disregard the "Expiration" value, this token will not expire unless it is revoked by the user or the application. Use the authentication token to create an Authorization header for each request:
Authorization: AuthSub token="DQAA...7DCTN"
For details, including information on registering your application with Google and other topics, see the AuthSub documentation.
Every request that you send using the Data API should specify version 2 of the API.
To specify a version number, use the GData-Version HTTP header:
GData-Version: 2
Alternatively, if you can't set HTTP headers, you can specify v=2 as a query parameter in the URL. But the HTTP header is preferred where possible.
Note: The client libraries supply appropriate version headers automatically, so don't use the v=2 query parameter when you're using a client library.
Albums are the way Picasa Web Albums groups photos into useful sets. These albums can be public or unlisted, and have their own properties such as a geographic location, a description, or a date.
You do not have to authenticate to retrieve data about public albums, but in order to create, update, or delete content you must authenticate using one of the methods discussed in the authentication section.
To get a feed listing all of the albums belonging to user userID, send an HTTP request like the following to Picasa Web Albums:
GET http://picasaweb.google.com/data/feed/api/user/userID
Note: The string default can be used in place of a real user ID, in which case the server uses the ID of the user whose credentials authenticated the request.
The server returns a feed of album entries, which looks similar to the following:
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:exif='http://schemas.google.com/photos/exif/2007'
xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#'
xmlns:gml='http://www.opengis.net/gml'
xmlns:georss='http://www.georss.org/georss'
xmlns:batch='http://schemas.google.com/gdata/batch'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"CkABRXY8fip7ImA9WxVVGE8."'>
<id>http://picasaweb.google.com/data/feed/api/user/liz</id>
<updated>2009-03-12T01:19:14.876Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#user' />
<title>liz</title>
<subtitle></subtitle>
<icon>http://iconPath/liz.jpg</icon>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz' />
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz' />
<link rel='http://schemas.google.com/photos/2007#slideshow'
type='application/x-shockwave-flash'
href='http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fliz%3Falt%3Drss' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz?start-index=1&max-results=1000&v=2' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<generator version='1.00' uri='http://picasaweb.google.com/'>
Picasaweb</generator>
<openSearch:totalResults>1</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>1000</openSearch:itemsPerPage>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<gphoto:thumbnail>
http://thumbnailPath/liz.jpg</gphoto:thumbnail>
<gphoto:quotalimit>1073741824</gphoto:quotalimit>
<gphoto:quotacurrent>32716</gphoto:quotacurrent>
<gphoto:maxPhotosPerAlbum>500</gphoto:maxPhotosPerAlbum>
<entry gd:etag='"RXY8fjVSLyp7ImA9WxVVGE8KQAE."'>
<id>http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID</id>
<published>2005-06-17T07:09:42.000Z</published>
<updated>2009-03-12T01:19:14.000Z</updated>
<app:edited xmlns:app='http://www.w3.org/2007/app'>
2009-03-12T01:19:14.000Z</app:edited>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#album' />
<title>lolcats</title>
<summary>Hilarious Felines</summary>
<rights>public</rights>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID?authkey=authKey&v=2' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/lh/album/aFDUU2eJpMHZ1dP5TGaYHxtMTjNZETYmyPJy0liipFm0?authkey=authKey' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID?authkey=authKey&v=2' />
<link rel='edit' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/1236820754876000?authkey=authKey&v=2' />
<link rel='http://schemas.google.com/acl/2007#accessControlList'
type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/acl?authkey=authKey&v=2' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<gphoto:id>albumID</gphoto:id>
<gphoto:location>Mountain View, CA</gphoto:location>
<gphoto:access>public</gphoto:access>
<gphoto:timestamp>1118992182000</gphoto:timestamp>
<gphoto:numphotos>1</gphoto:numphotos>
<gphoto:numphotosremaining>499</gphoto:numphotosremaining>
<gphoto:bytesUsed>23044</gphoto:bytesUsed>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<media:group>
<media:title type='plain'>lolcats</media:title>
<media:description type='plain'>Hilarious
Felines</media:description>
<media:keywords></media:keywords>
<media:content url='http://imagePath/Lolcats.jpg' type='image/jpeg' medium='image' />
<media:thumbnail url='http://thumbnailPath/Lolcats.jpg' height='160' width='160' />
<media:credit>Liz</media:credit>
</media:group>
</entry>
</feed>
For information about what each of those elements means, see the Picasa Web Albums Data API Reference document, the Google Data APIs Protocol Reference document, or the Atom 1.0 specification.
You can create an album by sending an authenticated POST request with an appropriately formed entry. To authenticate, use one of the authentication mechanisms discussed in the Authentication section.
POST http://picasaweb.google.com/data/feed/api/user/userID
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gphoto='http://schemas.google.com/photos/2007'>
<title type='text'>Trip To Italy</title>
<summary type='text'>This was the recent trip I took to Italy.</summary>
<gphoto:location>Italy</gphoto:location>
<gphoto:access>public</gphoto:access>
<gphoto:timestamp>1152255600000</gphoto:timestamp>
<media:group>
<media:keywords>italy, vacation</media:keywords>
</media:group>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#album'></category>
</entry>
Picasa Web Albums creates a new album using the data you sent, then returns an HTTP 201 status code, along with a copy of the new album in the form of an <entry> element. The returned entry is similar to the one you sent, but the returned one contains various elements added by the server, such as an <id> element.
If your request fails for some reason, then a different status code may be returned. For information about the status codes used by the API, see the HTTP status codes section of the Google Data APIs protocol reference document.
After retrieving an album entry, you can modify it by sending a PUT request, containing the new album data, to the URI given in the <link rel="edit"> element.
PUT http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID
To make sure that your update doesn't overwrite another client's changes, include an HTTP If-Match header that contains the original album's ETag value. You can determine the original album's ETag value by examining the <entry> element's gd:etag attribute.
If you want to update the album regardless of whether someone else has updated it since you retrieved it, then use If-Match: * and don't include the ETag.
For more information about ETags, see the Google Data APIs reference guide.
You can delete an album by sending an authenticated HTTP DELETE request to the URI inside of the <link rel="edit">:
DELETE http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID
If you want to make sure that you don't delete an album that has been changed by another client since you retrieved it, include an HTTP If-Match header that contains the original album's ETag value. You can determine the original album's ETag value by examining the <entry> element's gd:etag attribute.
If you want to delete the album regardless of whether someone else has updated it since you retrieved it, then use If-Match: * and don't include the ETag. (In this case, you don't need to retrieve the album before deleting it.)
For more information about ETags, see the Google Data APIs reference guide.
When uploading, modifying, or removing photos, you will have to authenticate using one of the methods discussed in the Authentication section.
There are different ways to retrieve photos. The most common is to get a list of all of the photos in an album, but you can also retrieve recent photos from a user, or search photos from the public albums of other users.
To get a feed listing all of the photos in an album with the id albumID, belonging to user userID, send an HTTP request like the following to Picasa Web Albums:
GET http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID
Note: The string default can be used in place of a real user ID, in which case the server will use the user ID of the user whose credentials were used to authenticate the request.
In this example, we're retrieving the album by its ID, which can be found in the <gphoto:id> element of the Album entry.
Note: The entries in a feed are ordered based upon the display order on the web site.
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:app='http://www.w3.org/2007/app'
xmlns:exif='http://schemas.google.com/photos/exif/2007'
xmlns:georss='http://www.georss.org/georss'
xmlns:gml='http://www.opengis.net/gml'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"A0MBR347eCp7ImA9WxRbFkQ."'>
<id>http://picasaweb.google.com/data/feed/user/liz/albumid/albumID</id>
<updated>2008-12-08T01:24:16.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#album' />
<title>lolcats</title>
<subtitle>Hilarious Felines</subtitle>
<rights>public</rights>
<icon>http://iconPath/Lolcats.jpg</icon>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID' />
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz/Lolcats' />
<link rel='http://schemas.google.com/photos/2007#slideshow'
type='application/x-shockwave-flash'
href='http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fliz%2Falbumid%2FalbumID%3Falt%3Drss' />
<link rel='http://schemas.google.com/photos/2007#report'
type='text/html'
href='http://picasaweb.google.com/lh/reportAbuse?uname=liz&aid=albumID' />
<link rel='http://schemas.google.com/acl/2007#accessControlList'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID/acl' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID?start-index=1&max-results=1000&v=2' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<generator version='1.00' uri='http://picasaweb.google.com/'>
Picasaweb</generator>
<openSearch:totalResults>1</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>1000</openSearch:itemsPerPage>
<gphoto:id>albumID</gphoto:id>
<gphoto:location>Mountain View, CA, USA</gphoto:location>
<gphoto:access>public</gphoto:access>
<gphoto:timestamp>1150527600000</gphoto:timestamp>
<gphoto:numphotos>1</gphoto:numphotos>
<gphoto:numphotosremaining>499</gphoto:numphotosremaining>
<gphoto:bytesUsed>23044</gphoto:bytesUsed>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<georss:where>
<gml:Point>
<gml:pos>37.38911780598221 -122.08638668060303</gml:pos>
</gml:Point>
<gml:Envelope>
<gml:lowerCorner>37.38482151758655 -122.0958924293518</gml:lowerCorner>
<gml:upperCorner>37.39341409437787 -122.07688093185425</gml:upperCorner>
</gml:Envelope>
</georss:where>
<gphoto:allowPrints>true</gphoto:allowPrints>
<gphoto:allowDownloads>true</gphoto:allowDownloads>
<entry gd:etag='"Qns7fDVSLyp7ImA9WxRbFkQCQQI."'>
<id>http://picasaweb.google.com/data/entry/user/liz/albumid/albumID/photoid/photoID</id>
<published>2008-08-15T18:58:44.000Z</published>
<updated>2008-12-08T01:11:03.000Z</updated>
<app:edited>2008-12-08T01:11:03.000Z</app:edited>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#photo' />
<title type='text'>invisible_bike.jpg</title>
<summary type='text'>Bike</summary>
<content type='image/jpeg'
src='http://photoPath/invisible_bike.jpg' />
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID/photoid/photoID' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz/Lolcats#photoID' />
<link rel='http://schemas.google.com/photos/2007#canonical'
type='text/html'
href='http://picasaweb.google.com/lh/photo/THdOPB27qGrofntiI91-8w' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/photoid/photoID' />
<link rel='edit' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/photoid/photoID' />
<link rel='edit-media' type='image/jpeg'
href='http://picasaweb.google.com/data/media/api/user/liz/albumid/albumID/photoid/photoID' />
<link rel='http://schemas.google.com/photos/2007#report'
type='text/html'
href='http://picasaweb.google.com/lh/reportAbuse?uname=liz&aid=albumID&iid=photoID' />
<gphoto:id>photoID</gphoto:id>
<gphoto:position>1.66002086E9</gphoto:position>
<gphoto:albumid>albumID</gphoto:albumid>
<gphoto:access>public</gphoto:access>
<gphoto:width>410</gphoto:width>
<gphoto:height>295</gphoto:height>
<gphoto:size>23044</gphoto:size>
<gphoto:client />
<gphoto:checksum />
<gphoto:timestamp>1218826724000</gphoto:timestamp>
<gphoto:commentCount>0</gphoto:commentCount>
<exif:tags>
<exif:imageUniqueID>0657130896bace739a44ce90a7d5b451</exif:imageUniqueID>
</exif:tags>
<media:group>
<media:content url='http://photoPath/invisible_bike.jpg'
height='295' width='410' type='image/jpeg' medium='image' />
<media:credit>Liz</media:credit>
<media:description type='plain'></media:description>
<media:keywords>invisible, bike</media:keywords>
<media:thumbnail url='http://thumbnailPath/s72/invisible_bike.jpg'
height='52' width='72' />
<media:thumbnail url='http://thumbnailPath/s144/invisible_bike.jpg'
height='104' width='144' />
<media:thumbnail url='http://thumbnailPath/s288/invisible_bike.jpg'
height='208' width='288' />
<media:title type='plain'>invisible_bike.jpg</media:title>
</media:group>
<georss:where>
<gml:Point>
<gml:pos>37.427399548633325 -122.1703290939331</gml:pos>
</gml:Point>
<gml:Envelope>
<gml:lowerCorner>37.42054944692195 -122.1825385093689</gml:lowerCorner>
<gml:upperCorner>37.4342496503447 -122.15811967849731</gml:upperCorner>
</gml:Envelope>
</georss:where>
</entry>
</feed>
It is also possible to retrieve the photos associated with a user, but without specifying any particular album. The following request retrieves the last 10 photos uploaded by userID:
GET http://picasaweb.google.com/data/feed/api/user/userID?kind=photo&max-results=10
For more information about the query parameters that can be used with the API, consult the query parameters section of the Reference Guide.
With the API, you can search photos uploaded by other users, as long as they are in a public album. The following request retrieves 10 photos matching a search for "puppy":
GET http://picasaweb.google.com/data/feed/api/all?q=puppy&max-results=10
This will return a feed that looks similar to the following:
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:exif='http://schemas.google.com/photos/exif/2007'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"AkMNQH47eCp7ImA9WxVVFEs."'>
<id>http://picasaweb.google.com/data/feed/all</id>
<updated>2009-03-07T23:28:11.000Z</updated>
<title>Search Results</title>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/all' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/all?q=puppy&start-index=1&max-results=10&v=2' />
<link rel='next' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/all?q=puppy&start-index=11&max-results=10&v=2' />
<generator version='1.00' uri='http://picasaweb.google.com/'>
Picasaweb</generator>
<openSearch:totalResults>1058343</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>10</openSearch:itemsPerPage>
<gphoto:crowded_length>100</gphoto:crowded_length>
<entry gd:etag='W/"DUIMQX47eCp7ImA9WxVVFEs."'>
<id>
http://picasaweb.google.com/data/entry/user/leangipima/albumid/5310560322838778321/photoid/5310587822172159186</id>
<published>2009-03-07T23:13:00.000Z</published>
<updated>2009-03-07T23:13:00.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#photo' />
<title>Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg</title>
<summary>Leangi Pima Bearded Collie 3 weeks old
puppies</summary>
<content type='image/jpeg'
src='http://lh5.ggpht.com/_QGFHG3wSwFw/SbL_fNEWPNI/AAAAAAAAFvg/ciZiBxQnJIw/Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg' />
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/leangipima/albumid/5310560322838778321/photoid/5310587822172159186' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/leangipima/BeardedCollieALitterStarsAtSeaZestfulVictoryFirstprizebearsEisenhower#5310587822172159186' />
<link rel='http://schemas.google.com/photos/2007#canonical'
type='text/html'
href='http://picasaweb.google.com/lh/photo/ftAWeRbvJAOytrHHJlrCRQ' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/leangipima/albumid/5310560322838778321/photoid/5310587822172159186' />
<link rel='http://schemas.google.com/photos/2007#report'
type='text/html'
href='http://picasaweb.google.com/lh/reportAbuse?uname=leangipima&aid=5310560322838778321&iid=5310587822172159186' />
<author>
<name>Leangi Pima</name>
<uri>http://picasaweb.google.com/leangipima</uri>
<email>leangipima</email>
<gphoto:user>leangipima</gphoto:user>
<gphoto:nickname>Leangi Pima</gphoto:nickname>
<gphoto:thumbnail>
http://lh5.ggpht.com/_QGFHG3wSwFw/AAAAnnz9V-s/AAAAAAAAAAA/CBUJRErBX4E/s48-c/leangipima.jpg</gphoto:thumbnail>
</author>
<gphoto:id>5310587822172159186</gphoto:id>
<gphoto:albumid>5310560322838778321</gphoto:albumid>
<gphoto:access>public</gphoto:access>
<gphoto:width>480</gphoto:width>
<gphoto:height>640</gphoto:height>
<gphoto:timestamp>1232983573000</gphoto:timestamp>
<exif:tags>
<exif:fstop>2.8</exif:fstop>
<exif:make>Canon</exif:make>
<exif:model>Canon PowerShot A610</exif:model>
<exif:exposure>0.016666668</exif:exposure>
<exif:flash>true</exif:flash>
<exif:focallength>7.3</exif:focallength>
<exif:time>1232983573000</exif:time>
</exif:tags>
<media:group>
<media:content url='http://lh5.ggpht.com/_QGFHG3wSwFw/SbL_fNEWPNI/AAAAAAAAFvg/ciZiBxQnJIw/Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg'
height='640' width='480' type='image/jpeg' medium='image' />
<media:credit>Leangi Pima</media:credit>
<media:description type='plain'>Leangi Pima Bearded Collie 3
weeks old puppies</media:description>
<media:keywords>Bearded Collie, Beardie, bradati koli,
bradati skotski ovcar, Firstprizebears Eisenhower, Leangi
Pima, leangipima, litter, puppies, puppy, Stars at Sea
Zestful Victory</media:keywords>
<media:thumbnail url='http://lh5.ggpht.com/_QGFHG3wSwFw/SbL_fNEWPNI/AAAAAAAAFvg/ciZiBxQnJIw/s72/Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg'
height='72' width='54' />
<media:thumbnail url='http://lh5.ggpht.com/_QGFHG3wSwFw/SbL_fNEWPNI/AAAAAAAAFvg/ciZiBxQnJIw/s144/Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg'
height='144' width='108' />
<media:thumbnail url='http://lh5.ggpht.com/_QGFHG3wSwFw/SbL_fNEWPNI/AAAAAAAAFvg/ciZiBxQnJIw/s288/Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg'
height='288' width='216' />
<media:title type='plain'>
Leangi_Pima_Bearded_Collie_puppies_3w_40.jpg</media:title>
</media:group>
<gphoto:albumtitle>Bearded Collie - A-litter - Stars at Sea
Zestful Victory & Firstprizebears
Eisenhower</gphoto:albumtitle>
<gphoto:albumdesc>Leangi Pima Bearded Collie
puppies</gphoto:albumdesc>
<gphoto:location>Belgrade, Serbia, Leangi Pima
kennel</gphoto:location>
<gphoto:snippet>... old
<b>puppies</b></gphoto:snippet>
<gphoto:snippettype>PHOTO_DESCRIPTION</gphoto:snippettype>
<gphoto:truncated>0</gphoto:truncated>
</entry>
...[Nine other entries here]...
</feed>
If you want to retrieve a photo that you've retrieved before, you can improve efficiency by telling Picasa Web Albums to send the photo only if it has changed since the last time you retrieved it.
To do this sort of conditional retrieval, send an HTTP GET request that includes an HTTP If-None-Match header. In the header, specify the photo's ETag, which you can find in the <entry> element's gd:etag attribute.
For example:
If-None-Match: "Qns7fDVSLyp7ImA9WxRbFkQCQQI."
When Picasa Web Albums receives this request, it checks to see whether the photo that you requested has the same ETag as the ETag you specified. If the ETags match, then the entry hasn't changed, and Picasa Web Albums returns an HTTP 304 Not Modified status code.
If the ETags don't match, then the photo has been modified since the last time you requested it, and Picasa Web Albums returns the photo.
For more information about ETags, see the Google Data APIs reference guide.
There are two ways to add a photo to an album using the Data API:
POST body, and binary-encoded image data in another part. This is the preferred approach.While all photos appearing on the Picasa Web Albums site are in the JPEG format, photos of any of the following types can be uploaded using the API:
To send metadata along with the photo, post to the following URL:
http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID
And use the following format for the body of the POST:
Content-Type: multipart/related; boundary="END_OF_PART"
Content-Length: 423478347
MIME-version: 1.0
Media multipart posting
--END_OF_PART
Content-Type: application/atom+xml
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>plz-to-love-realcat.jpg</title>
<summary>Real cat wants attention too.</summary>
<category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/photos/2007#photo"/>
</entry>
--END_OF_PART
Content-Type: image/jpeg
...binary image data...
--END_OF_PART--
Note that the <title> element contains the filename you want to use for the image.
To send a photo without its associated metadata, post to the following URL:
http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID
And use the following format for the body of the POST:
Content-Type: image/jpeg Content-Length: 47899 Slug: plz-to-love-realcat.jpg ...binary image data goes here...
The optional Slug: HTTP header specifies a filename for Picasa Web Albums to use for the photo. Not specifying a Slug: causes the server to use a default title for the image.
Note: If you want to post a photo, but don't want the hassle of requiring the user of your app to choose an album, you can post the photo to the "Drop Box." This special album will automatically be created the first time it is used to store a photo. To post to the Drop Box, use an albumID value of default: http://picasaweb.google.com/data/feed/api/user/default/albumid/default.
A video is posted in the same way as a photo with metadata. Instead of an image MIME type you have to use an appropriate video MIME type. The recognized video MIME types are:
Note: You cannot submit a video without metadata at this time. You must use a MIME multipart request like in the Posting a photo with metadata section.
Videos have to undergo some processing before they become available for streaming. In order to monitor the current processing state, the photo entry returned after posting a new video will contain an additional <gphoto:videostatus> element. The element can also be found in the photo feeds. The four possible values of the status element are:
pending: the video is still being processedready: the video has been processed but still needs a thumbnailfinal: the video has been processed and has received a thumbnailfailed: a processing error has occured and the video should be deletedUsually a video can be streamed/played or accessed at the URL provided in the <media:group> section of the entry feed shortly after reaching the status ready or final. The <media:content ... medium="video"> element will contain the URL to the FLV video stream.
Normally the video processing system will automatically provide a thumbnail at the end of the processing stage. This thumbnail is created from one of the first few frames of the video. Instead, you can provide your own thumbnail by simply following the steps outlined under Updating a photo. You can do this at any time while the video is still being processed or afterwards. Automatically provided thumbnails always come at QVGA resolution (320x240 pixels). To account for larger than 4:3 aspect ratios (e.g. 16:9), black borders will be added to the top and bottom of the thumbnail image.
All uploaded videos are processed and converted into streaming formats that can be played back using the Flash video player integrated into the Picasa Web Albums one-up view.
Two streaming formats are currently created: the H.263-based FLV320 with a maximum resolution of 320 by 240 pixels, and an mp4 stream with a maximum resolution of 480 x 360 pixels.
In both cases, the maximum upload size is 100MB.
You can't currently download original video files. However, you can download the FLV video stream or the mp4 video stream by using the URLs from the <media:content> video elements provided in the photo entry or feed. There's one <media:content> element for each video stream.
You can replace the metadata and/or the binary image data for a photo. The following sections explain how.
In each case, to make sure that your update doesn't overwrite another client's changes, include an HTTP If-Match header that contains the original photo's ETag value. You can determine the original photo's ETag value by examining the <entry> element's gd:etag attribute.
If you want to update the photo regardless of whether someone else has updated it since you retrieved it, then use If-Match: * and don't include the ETag.
For more information about ETags, see the Google Data APIs reference guide.
To replace both the binary data and metadata for the photo that you inserted earlier, use an HTTP request like the following:
PUT http://picasaweb.google.com/data/media/api/user/userID/albumid/albumID/photoid/photoID
The URI is the value of the <link rel="edit-media"> tag that was returned after you did the earlier POST.
In the body of the PUT, include the updated metadata and image data, in the same multipart format that you used to do the POST with metadata.
Note: As usual with Google Data APIs, you can't do a partial update of an entry; you have to send the full entry data to replace the existing data. The exception is that you can choose to send only the metadata or only the image, as described in the following sections.
To replace only the photo's binary data, use the following HTTP request:
PUT http://picasaweb.google.com/data/media/api/user/userID/albumid/albumID/photoid/photoID
The URI is the value of the <link rel="edit-media"> tag that was returned after you did the earlier POST.
In the body of the PUT, include the replacement image data, in the same format that you used to do the POST without metadata.
To replace only the photo's metadata (and not the image itself), you follow the steps that you would follow to send an update to a non-media feed.
In particular, send the following HTTP request:
PUT http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID/photoid/photoID
The URI is the value of the <link rel="edit"> tag that was returned after you did the earlier POST.
In the body of the PUT, provide the updated metadata, in the form of an <atom:entry> element containing image metadata.
Note: You can't do a partial update of an entry; you have to send the full entry metadata to replace the existing metadata.
The photo itself is not re-sent to the server.
To delete a photo and its metadata, send an HTTP DELETE request to either the edit link or the edit-media link. In both cases, the photo and metadata are deleted.
For example, to delete the photo from the previous examples:
DELETE http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID/photoid/photoID
If you want to make sure that you don't delete a photo that has been changed by another client since you retrieved it, include an HTTP If-Match header that contains the original photo's ETag value. You can determine the original photo's ETag value by examining the <entry> element's gd:etag attribute.
If you want to delete the photo regardless of whether someone else has updated it since you retrieved it, then use If-Match: * and don't include the ETag. (In this case, you don't need to retrieve the photo before deleting it.)
For more information about ETags, see the Google Data APIs reference guide.
Tags are a convenient way to label and organize your photos. By associating photos with descriptive strings, it makes searching through large quantities of photos easier.
Note: Picasa Web Albums tags are unrelated to ETags, and both are unrelated to the <exif:tags> element.
Your program can retrieve a list of tags that are used by a user, in a particular album, or that are associated with a particular photo.
The following request returns a feed of the tags that userID has used in photos in their albums:
GET http://picasaweb.google.com/data/feed/api/user/userID?kind=tag
Note: The string "default" can be used in place of a real user ID, in which case the server will use the user ID of the user whose credentials were used to authenticate the request.
The feed will look similar to the following:
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"CkcAQXc-eSp7ImA9WxJTFUk."'>
<id>http://picasaweb.google.com/data/feed/user/liz</id>
<updated>2009-04-24T02:27:20.951Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#user' />
<title>liz</title>
<subtitle />
<icon>http://iconPath/liz.jpg</icon>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz' />
<link rel='http://schemas.google.com/photos/2007#slideshow'
type='application/x-shockwave-flash'
href='http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fliz%3Falt%3Drss' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz?start-index=1&max-results=500&kind=tag&v=2' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<generator version='1.00' uri='http://picasaweb.google.com/'>
Picasaweb</generator>
<openSearch:totalResults>2</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>500</openSearch:itemsPerPage>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<gphoto:thumbnail>
http://thumbnailPath/liz.jpg</gphoto:thumbnail>
<gphoto:quotalimit>1073741824</gphoto:quotalimit>
<gphoto:quotacurrent>23044</gphoto:quotacurrent>
<gphoto:maxPhotosPerAlbum>500</gphoto:maxPhotosPerAlbum>
<entry gd:etag='W/"CkcAQXc-eSp7ImA9WxJTFUk."'>
<id>http://picasaweb.google.com/data/entry/user/liz/tag/invisible</id>
<updated>2009-04-24T02:27:20.951Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#tag' />
<title>invisible</title>
<summary>invisible</summary>
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/lh/searchbrowse?q=invisible&psc=G&uname=liz&filter=0' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/tag/invisible' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
</entry>
...[Another entry here]...
</feed>
The following request will return a feed of tags that userID has tagged photos with in the album with ID albumID.
http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID?kind=tag
The following request will return a feed of tags that userID has tagged the photo identified by photoID with in the album with ID albumID. You can inspect the <gphoto:id> element of a photo entry to find a value for photoID.
http://picasaweb.google.com/data/feed/api/user/default/albumid/albumID/photoid/photoID?kind=tag
Note that this same information is available inside of the <media:keywords> element of the photo itself in a comma separated format.
The following request uses the tag parameter to search for all photos belonging to userID that are tagged with both "foo" and "bar".
http://picasaweb.google.com/data/feed/api/user/userID?kind=photo&tag=foo,bar
Note: You can search for photos in a particular album by adding the album ID to the end of the feed. Also, the comma should be percent-escaped to "%2C" in your actual request.
The following request adds the tag "awesome" to the photo identified by photoID, in the album with ID albumID which is owned by userID.
POST http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID/photoid/photoID
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>awesome</title>
<category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/photos/2007#tag"/>
</entry>
Note that this can also be done in bulk as described in the Updating a photo section using the <media:keywords> element.
To delete a tag, send an HTTP DELETE request to that tag's edit link:
DELETE http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID/photoid/photoID/tag/tagID
Comments are short text snippets attached to photos by Picasa Web Albums users.
The following request returns a feed of the 10 most recent comments on a userID's photos.
The string "default" can be used in place of a real userID, in which case the server will use the userID of the user credentials used to authenticate the request.
GET http://picasaweb.google.com/data/feed/api/user/default?kind=comment&max-results=10
The resulting feed will look similar to the following:
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:app='http://www.w3.org/2007/app'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"CEUDRHg8eSp7ImA9WxJTFUk."'>
<id>http://picasaweb.google.com/data/feed/user/liz</id>
<updated>2009-04-24T03:04:35.671Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#user' />
<title>liz</title>
<subtitle />
<icon>
http://iconPath/liz.jpg</icon>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz' />
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz' />
<link rel='http://schemas.google.com/photos/2007#slideshow'
type='application/x-shockwave-flash'
href='http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fliz%3Falt%3Drss' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz?start-index=1&max-results=10&kind=comment&v=2' />
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<generator version='1.00' uri='http://picasaweb.google.com/'>
Picasaweb</generator>
<openSearch:totalResults>3</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>10</openSearch:itemsPerPage>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<gphoto:thumbnail>
http://thumbnailPath/liz.jpg</gphoto:thumbnail>
<gphoto:quotalimit>1073741824</gphoto:quotalimit>
<gphoto:quotacurrent>23044</gphoto:quotacurrent>
<gphoto:maxPhotosPerAlbum>500</gphoto:maxPhotosPerAlbum>
<entry gd:etag='W/"A0cGQX47eCp7ImA9WB5RFk8."'>
<id>
http://picasaweb.google.com/data/entry/user/liz/albumid/albumID/photoid/photoID/commentid/commentID</id>
<published>2007-06-23T20:03:40.000Z</published>
<updated>2007-06-23T20:03:40.000Z</updated>
<app:edited>2007-06-23T20:03:40.000Z</app:edited>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#comment' />
<title>Darcy</title>
<content>I say! What an amusing image!</content>
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/lh/photo/EtlFQvsZI9NxSfRbaZCSXQ' />
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/photoid/photoID/commentid/commentID' />
<link rel='edit' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID/photoid/photoID/commentid/commentID' />
<author>
<name>Darcy</name>
<uri>http://picasaweb.google.com/darcy</uri>
<gphoto:user>darcy</gphoto:user>
<gphoto:nickname>Darcy</gphoto:nickname>
<gphoto:thumbnail>
http://thumbnailPath/darcy.jpg</gphoto:thumbnail>
</author>
<gphoto:id>commentID</gphoto:id>
<gphoto:photoid>photoID</gphoto:photoid>
</entry>
...[Other entries here]...
</feed>
You can also retrieve all of the comments associated with a particular photo. The following response retrieves a feed of the comments on the photo identified by photoID, inside of the album with ID albumID, owned by the user userID.
GET http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID/photoid/photoID?kind=comment
The following request adds the comment "great photo!" to the photo identified by photoID in the album with ID albumID owned by userID.
POST http://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID/photoid/photoID
<entry xmlns='http://www.w3.org/2005/Atom'>
<content>great photo!</content>
<category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/photos/2007#comment"/>
</entry>
To delete a comment, you can use a HTTP DELETE on that comment's edit link:
DELETE http://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID/photoid/photoID/commentid/commentID