Facebook API: Get all profile pictures

后端 未结 6 1743
野的像风
野的像风 2020-12-23 21:26

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.fa

6条回答
  •  长情又很酷
    2020-12-23 22:05

    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/

提交回复
热议问题