Facebook的图形API:获得一个随机N的朋友? [英] Facebook Graph API: Getting a random N friends?

查看:131
本文介绍了Facebook的图形API:获得一个随机N的朋友?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可能 -

I'm unsure if this is possible --

我开发一个Android的游戏,我希望它包括15个随机好友资料照片。

I'm developing an Android game, and I want it to include profile pictures of 15 random friends.

不过,似乎我唯一的选择就是调用图形API/我/的朋友(几次,分页),以获得的的用户朋友都的,存储列表,然后随机选择朋友的一个子集,并检索他们的个人资料照片。

However, it seems my only option is to call the graph API "/me/friends" (several times, with paging) to get all of a users friends, store the list, then randomly select a subset of friends and retrieve their profile photos.

我在想,如果有到图形API调用一次随机排序,或以某种方式减轻这种工作的足迹,这样我可以用自己的服务器端?极限= 15 来减少我的应用程序必须做出的要求。

I was wondering if there's a single call to the Graph API to sort randomly, or somehow reduce the footprint of this job, so that I can use their server-side ?limit=15 to reduce the requests my app has to make.

谢谢!

推荐答案

这通过FQL查询,您可以用图形API运行是可能

This is possible via FQL query which you can run with Graph API

SELECT uid, name FROM user WHERE uid IN (
  SELECT uid2 FROM friend WHERE uid1 = me()
) ORDER BY rand() limit 15

要通过图形API得到它,你只需要发出GET请求:

To get it via Graph API you just need to issue GET request to:

GET http://graph.facebook.com/fql?q={QUERY_HERE}

这篇关于Facebook的图形API:获得一个随机N的朋友?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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