views:

131

answers:

1

A client of mine would like to be able to update her site's image galleries by adding images to albums on her facebook account. Is this possible using JSON? would the albums she chose to display need to be made public? Thanks for any help on this!

+3  A: 

This is definitely possible by using the graph api:

Get the ID of all of her albums - select the one you want:

https://graph.facebook.com/me/albums/

Access the album:

https://graph.facebook.com/ALBUM_ID/photos

You need the user_photos permission and the album needs to be public.

This returns you a list of all the photos in the following JSON form:

{
          "id": "104988432890979",
                 "from": {
                    "name": "Patrick Snape",
                    "id": "100001394674670"
                 },
                 "picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc4/hs272.snc4/39934_104988432890979_100001394674670_46790_6171664_s.jpg",
                 "source": "http://sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs272.snc4/39934_104988432890979_100001394674670_46790_6171664_n.jpg",
                 "height": 540,
                 "width": 720,
                 "link": "http://www.facebook.com/photo.php?pid=46790&id=100001394674670",
                 "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif",
                 "created_time": "2010-08-11T10:32:45+0000",
                 "updated_time": "2010-08-11T10:32:47+0000"
              }
}

You can then use the source of the photo to get the full sized image

BeRecursive
awesome! thanks a lot dude!
measles