DanH
DanH

Reputation: 5818

Query Picasa Web Albums for specific PhotoIDs to check for existence

I have a list of PhotoIDs as well as the User ID which apparently is required as PhotoID is not globally unique, and I'm attempting to get a list of photos in order to test whether the photos are still accessible.

The closest I've found so far is here https://groups.google.com/forum/?fromgroups=#!searchin/google-picasa-data-api/photos$20by$20id/google-picasa-data-api/OzLyJOVpd4M/7xiSPB4Tg9YJ which mentions the following query should get me there:

http://picasaweb.google.com/data/feed/api/user/default/?kind=photo&v=2&fields=entry[gphoto:id=1234 or gphoto:id=4567]&prettyprint=true

However this doesn't appear to work, even when used with photos I know to exist, I either get:

<?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:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005'/>

Or if I specify a valid access_token I get the following, despite the token working fine for more basic queries of unlisted photos.

Token invalid - AuthSub token has wrong scope

UPDATE

I've managed to get querying single gphoto:id work using the following:

https://picasaweb.google.com/data/feed/api/user/default?kind=photo&v=2.0&fields=entry[gphoto:id=5833637579580309538]

However as soon as I attempt to use || (as suggested below) I get an error such as:

Invalid selector expression at position 35: no viable alternative at character '|'  

If I use " or " as alluded to in the Google API Documentation, it simply ignores all but the first gphoto:id return only 1 row.

UPDATE 2

Actually it looks like the following DOES work, however not for all photos:

https://picasaweb.google.com/data/feed/api/user/default?kind=photo&v=2.0&fields=entry[gphoto:id=5827988830283069682%20or%20gphoto:id=5812362364496750642](gphoto:id)&prettyprint=true

Is there some sort of permissioning that prevents some photos from being directly query-able?

Upvotes: 2

Views: 1052

Answers (1)

Mark S.
Mark S.

Reputation: 4019

You need to use '||' instead of 'or' in the request. I was able to select multiple photos in an album with this request.

https://picasaweb.google.com/data/feed/api/user/default/albumid/{albumid}?kind=photo&[gphoto.id={photo1 id}||gphoto.id={photo2 id}]

Upvotes: 2

Related Questions