Facebook API Question: Access of Friend Photos?
by Steve Poland

If anyone has experience with the Facebook API — I’m curious about two calls (maybe more): friends.get and photos.get [and possibly photos.getAlbums].

What I’m trying to do is have a logged-in FB user, in my FB app, be able to browse photos uploaded by friends [not necessarily with themselves in those photos -- but just to see photos by their friends]. Is this possible?

My other question is whether it’s possible to grab comments on photos, for display in my app.

Thanks for any help!


Subscribe to Steve Poland's blog by Email


Want to read more stuff by me? Here are some of my popular posts: Read my other start-up related posts.
  • John

    I like to use direct fql queries myself, then you can say the exact data you want back. To get the photos you’ll probably want to do two calls, one to get the albums for that user and then do a call to get the photos for that album when they drill down.

    “select aid, cover_pid from album where owner = FACEBOOK_ID”
    gets the albums

    “select pid, link, src from photo where aid = ALBUM_ID”
    gets the photos for an album

    you can probably turn these into a single query if you’d like as well, depending on the api wrapper you’re using there might be an easier way to do this as well.

    As to your second question, as far as I know you can’t get the comments for a photo, you can only get the caption the owner has added.

    Hope that helps!

  • Steve Poland

    @John – thx; so with those queries I could ‘get friends’ of a userID, then use that query to grab the photos for each of those friends’ userIDs?

    And I’m so far removed from SQL, but I could specify all those userIDs in that single SQL query, right?

  • John

    ya, that’s right

    “select aid, cover_pid from album where owner in (friend_id_1, friend_id_2,friend_id_2)”

    gets all the albums for those friends. are you going to show all the albums on one big page? I would probably use the facebook friend selector to let the user the friend, it refreshes the page with the albums for that friend which the user can drill into to see the photos in that album.

    What you you building your app in, php, ruby java? There are probably some easier ways to do this depending on the api wrapper you’re using.