【发布时间】:2013-02-22 14:34:39
【问题描述】:
我想使用带有打开图 2 操作的图 api 执行类似 facepile 的操作:从自定义对象和自定义对象,给我(使用我的 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" }
]
这是非常低效的,并没有完全解决我的问题,因为:
- 我仍然需要过滤结果以仅获得匹配的结果 我想要的对象
- 如果namespace:testaction中有大量的对象,我必须通过分页,做更多的查询(我尽量减少查询的数量)
你有没有更好的方法来做到这一点?
【问题讨论】:
-
尝试使用 Facebook Activity 插件和自定义打开图形操作,正如我所描述的 here
-
情况变了还是我们还要使用批量请求?
标签: api facebook-graph-api facebook-opengraph facebook-social-plugins open-graph-beta