Facebook API:获取所有个人资料图片 [英] Facebook API: Get all profile pictures
问题描述
从给定的用户获取所有个人资料图片的最佳方式是什么?我需要什么权限?
What is the best way to get ALL profile pictures from a given user? What permissions do I need?
我知道我可以使用 https://graph.facebook.com/ [uid] /图片
,但如何获得整张专辑?
I know I can access the main profile pic using https://graph.facebook.com/[uid]/picture
, but how do I get the entire album?
推荐答案
如何获得整张专辑?
how do I get the entire album?
您需要 https://graph.facebook.com/ [uid] / albums?access_token = [AUTH_TOKEN]
以获取用户的所有相册的JSON数组。
You need https://graph.facebook.com/[uid]/albums?access_token=[AUTH_TOKEN]
to get JSON array of all the albums of a user.
您将从这里获得三个重要的东西 id
- 相册ID,名称
- 相册名称和
类型
- 相册类型。
You will get three important things from here id
- album id, name
- album name, and type
- album type.
我需要什么权限?
What permissions do I need?
需要的权限是 user_photos
看到这里
获取给定用户的所有个人资料图片的最佳方式是什么?
What is the best way to get ALL profile pictures from a given user?
个人资料图片在个人资料图片相册下。要获得个人资料相册,您需要查看相册数组(如前所述),迭代JSON结果集,直到获得名为= $ code>个人资料图片并键入= 个人资料
。获取此对象的 id
。这是 个人资料图片相册。
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.
现在,您可以访问类似于您访问任何其他相册的访问。也就是说, https://graph.facebook.com/ [ALBUM_ID] / photos?access_token = [AUTH_TOKEN]
这将列出用户上传的所有个人资料照片。
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.
希望这有帮助。
参考: http://developers.facebook.com/docs/reference/api/
这篇关于Facebook API:获取所有个人资料图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!