Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook API: Get all profile pictures

Tags:

What is the best way to get ALL profile pictures from a given user? What permissions do I need?

I know I can access the main profile pic using https://graph.facebook.com/[uid]/picture, but how do I get the entire album?

like image 843
Andy Hin Avatar asked Feb 20 '11 16:02

Andy Hin


People also ask

How can I see all the profile pictures on Facebook?

To see an album of your past profile or cover photos: From your Feed, tap your profile picture in the top right. Scroll down and tap Photos, then tap Albums at the top. Tap Profile Pictures or Cover Photos.

How do I find Facebook user data?

You can get user data by using the Facebook Graph API if the user has given their permission to share their data and your app has the appropriate permissions to receive this data. This topic shows you how to make a single request for data and how to have a batch of requests in a single request.


1 Answers

how do I get the entire album?

You need https://graph.facebook.com/[uid]/albums?access_token=[AUTH_TOKEN] to get JSON array of all the albums of a user.

You will get three important things from here id - album id, name - album name, and type - album type.

What permissions do I need?

The permission required is user_photos see here

What is the best way to get ALL profile pictures from a given user?

Profile Pictures are under "Profile Pictures" album. To get to profile album, you need to look into albums array (as mentioned previously), iterate through the JSON result-set, until you get an album with name = Profile Pictures and type = profile. Get id of this object. This is the profile pictures album.

Now you can access it similar to you access any other album. That is, https://graph.facebook.com/[ALBUM_ID]/photos?access_token=[AUTH_TOKEN] this will list all the profile pictures of the user ever uploaded.

Hope this helps.

refer: http://developers.facebook.com/docs/reference/api/

like image 89
Nishant Avatar answered Nov 07 '22 17:11

Nishant