Query all friends in a network
Is there any way to retrieve all friends in a particular network?开发者_Go百科 For example, How can I view the list of my Facebook friends joined the network of my organization.
I think you can say
SELECT uid, name
FROM user
WHERE
affiliations.nid = [your network id]
AND uid IN (SELECT uid2 FROM friend WHERE uid1=[your user id])
You can write an FQL query such as this:
SELECT uid, name FROM user WHERE affiliations.nid = <your network id>
The problem is that affiliations are not indexable, so you would need to have a constraint on either the username
, name
, or uid
column(s) (which kind of defeats the purpose).
So the moral of the story is that if you know the ID of the user or are able to generate a range of users, then you can fetch this data. Otherwise, Facebook pukes on you.
Hope this helps!
精彩评论