Sch*_*ron 22 api facebook-graph-api facebook-social-plugins facebook-opengraph open-graph-beta
我想这样做facepile使用图形API开放图2点的操作:从自定义对象和自定义对象,给我做了这个对象上这个动作的朋友(使用我的Facebook应用程序).
问题是使用FQL,我无法查询自定义对象和操作.使用图形API,我无法找到一种方法将我的朋友列表与我感兴趣的对象相交.
我能做的最好的是使用图API的批处理模式:
batch=[
// First we get the list of friends that are using my facebook application
{ "method": "GET", "relative_url": "fql?q=SELECT+uid+FROM+user+WHERE+uid+IN+(SELECT+uid1+FROM+friend+WHERE+uid2=me())+AND+is_app_user=1+LIMIT+0,49", "name": "friends"},
// Then query each friend to get the list of objects that went through my namespace:testaction
{ "method": "GET", "relative_url": "{result=friends:$.data.0.uid}/namespace:testaction" },
{ "method": "GET", "relative_url": "{result=friends:$.data.1.uid}/namespace:testaction" },
...
{ "method": "GET", "relative_url": "{result=friends:$.data.49.uid}/namespace:testaction" }
]
Run Code Online (Sandbox Code Playgroud)
这是非常低效的,并没有完全解决我的问题,因为:
你看到更好的方法吗?
这可能不是你想要的,但鉴于facebook(AFAIK)没有提供(并且可能永远不会提供)这样做的能力.我认为您应该自己存储信息,然后从您自己的数据库中查询数据.这就像你在问题中所做的那样,但你可以优化它,因为它是你的数据库.
我相信你已经考虑过了,但有人不得不说出来.
小智 3
现在可以通过一个 Graph API 请求来完成此操作:
GET https://graph.facebook.com/me/friends?limit=50&fields=name,namespace:testaction.limit(100)
Run Code Online (Sandbox Code Playgroud)