Hey again Mike. That worked great, thanks. I don't suppose there is a way to get a view count for an album? Either a count of how many times the album is viewed / requested or a total count of the views for each photo in an album. I would like to be able to highlight the most popular albums / photos.
On a related note, is there a way to get all of the "full" PhotoEntry objects for an album? Or do I need to request them one by one as in your example below? Thanks so much for any advice. --Brian. On Tuesday, September 18, 2012 7:11:54 PM UTC-4, Mike Erickson wrote: > > I have a solution,although you might not think it's a good solution. The > problem is that the view count is only correctly returned for PhotoEntry > requests that are requested directly. So although the AlbumFeed contains > PhotoEntry objects, those objects will not work for you. > > But you can do this: > > String albumId = "5789637314433011089"; > feedURL = new URL( > String.format(" > https://picasaweb.google.com/data/feed/api/user/default/albumid/%s?v=2&kind=photo", > > albumId)); > > AlbumFeed albumFeed = myService.getFeed(feedURL, AlbumFeed.class); > for (PhotoEntry photo : albumFeed.getPhotoEntries()) { > String photoId = photo.getGphotoId(); > URL photoEntryUrl = new URL( > String.format(" > https://picasaweb.google.com/data/entry/api/user/default/albumid/%s/photoid/%s?v=2 > ", > albumId, photoId)); > PhotoEntry photoEntry = myService.getEntry(photoEntryUrl, > PhotoEntry.class); > System.out.println("View count = " + photoEntry.getViewCount()); > } > > The thing to notice is that the URL for the nested request is > .../data/entry/api... instead of .../data/feed/api... > > I hope that helps, at least a little. > -Mike > > On Tuesday, September 18, 2012 12:38:27 PM UTC-7, Bmeist wrote: >> >> Greetings, I cannot seem to get anything other than null to return from >> PhotoEntry.getViewCount(). All of my photos have view counts shown on the >> picasaweb interface. Also, hasViewCountExt() returns false for all of >> them. If I paste the URL into a browser and view the source, I can see the >> correct view count. Thanks very much for any advice! >> >> URL feedURL = new URL(" >> https://picasaweb.google.com/data/feed/api/user/118157739053519600454/albumid/5783763403683349537/photoid/5783763444234578498?v=2 >> "); >> >> Query query = new Query(feedURL); >> query.setStringCustomParameter("kind", "photo"); >> >> int numPhotos = feed.getPhotoEntries().size(); >> AlbumFeed feed = picasaService.query(query, AlbumFeed.class); >> for (int i = 0; i < numPhotos; i++) { >> PhotoEntry photo = (PhotoEntry) feed.getPhotoEntries().get(i); >> System.out.println("view count = " + photo.getViewCount()); >> } >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "Google Picasa Web Albums API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-picasa-data-api/-/Nxg8GpB_n7YJ. To post to this group, send email to google-picasa-data-api@googlegroups.com. To unsubscribe from this group, send email to google-picasa-data-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-picasa-data-api?hl=en.