Facebook Graph API - 获取朋友的信息 [英] Facebook Graph API - get friends info

查看:147
本文介绍了Facebook Graph API - 获取朋友的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何使用Graph API或FQL获取用户的朋友信息



只是为了测试我想让我的朋友 education_histroy



为此,我创建了一个测试应用程序,请使用

  scope = offline_access,manage_friendlists,friends_work_history,
friends_education_history,friends_about_me

,并获得访问令牌来玩API。



当我使用 /我。但是,对于我的朋友来说,它不会返回任何东西。



我假设如果我要求,我们假设 friends_work_history 当我通过朋友的身份查询时,字段( work_history )将出现在朋友的对象内,



https://graph.facebook.com/FRIEND_ID&access_token=TOKEN



但是我看到的只是关于该用户(朋友)的基本信息。



然后我试图请求该字段具体:



https://graph.facebook.com/ FRIEND_ID?fields = work& access_token = TOKEN



再没有运气。只返回朋友的ID ..



我尝试使用FQL访问该信息:



https:// API = b

返回 work_history = TRUE 而不是数组。那个朋友肯定有指定的工作历史。



有人可以帮助我了解如何使用我的应用和扩展权限获取朋友的信息?

解决方案

Graph API是大多数情况下的明智选择。要检索您的朋友信息,您需要先从用户处收集一些扩展权限。然后,您可以检索除基本信息之外的更多信息。



以下是与朋友不同类型信息相关的扩展权限列表

  friends_about_me 
friends_activities
friends_birthday
friends_checkins
friends_education_history
friends_events
friends_games_activity
friends_groups
friends_hometown
friends_interests
friends_likes
friends_location
friends_notes
friends_online_presence
friends_photo_video_tags
friends_photos
friends_relationship_details
friends_relationships
friends_religion_politics
friends_status
friends_subscriptions
friends_videos
friends_website
friends_work_history

希望它帮助:)


I'm trying to figure out how to get users friends information using either Graph API or FQL

Just for testing I would like to get my friends education_histroy.

To do that I created a test app, requested extended permissions using

scope=offline_access,manage_friendlists,friends_work_history,
      friends_education_history,friends_about_me

and got access token to play with the API.

It works great when I query for current user using /me. But it returns nothing for my friends.

I was assuming that if I request, let's say friends_work_history, that extra field (work_history) will appear inside friend's object, when I query by friend's id:

https://graph.facebook.com/FRIEND_ID&access_token=TOKEN

But all I see is basic info about that user (friend).

Then I tried to request that field specifically:

https://graph.facebook.com/FRIEND_ID?fields=work&access_token=TOKEN

With no luck again. Returns just friend's id..

I tried to access that information with FQL:

https://api.facebook.com/method/fql.query?query=select+work_history+from+user+where+uid+in+(FRIEND_ID)&access_token=TOKEN

Returns work_history = TRUE instead of array. And that friend definitely has work history specified.

Can someone help me to understand how to get friends info using my app and extended permissions?

解决方案

Graph API is the smart choice in most cases. To retrieve your friend information you need to collect some extended permissions from the user first. Then you can retrieve a lot more information other than the basic ones.

Following is a list of extended permissions related to friends different kind of information

friends_about_me        
friends_activities      
friends_birthday
friends_checkins        
friends_education_history       
friends_events
friends_games_activity      
friends_groups      
friends_hometown
friends_interests       
friends_likes       
friends_location
friends_notes       
friends_online_presence     
friends_photo_video_tags 
friends_photos      
friends_relationship_details        
friends_relationships
friends_religion_politics       
friends_status      
friends_subscriptions
friends_videos      
friends_website     
friends_work_history

Hope it helps :)

这篇关于Facebook Graph API - 获取朋友的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆