getting the list of friends and to know if they ha

2019-03-22 05:09发布

问题:

I'm using Eclipse FDT to write a Flex application for facebook on a facebook page. I want to be able to fetch the friends list of that same user and to distinguish between friends who installed the app and friends who didn't.

I searched on stackoverflow and I saw that users did that using the old REST API, the question is can I do that with graph api ?

if it's not possible using graph api at all... so how to do with REST API ?! :)

with the following request:

https://graph.facebook.com/me/friends?access_token?XXX

I can fetch the list of friends of that user. but it doesn't provide a flag if my app is installed. what can I do exactly and how ?!

Thanks!

回答1:

You have two ways to do it, with the graph api and with fql.

Using the graph api you can make a request to: /me/friends?fields=installed which should return a list of users, the ones that have the app installed will have this form:

{
    "installed": true, 
    "id": "USER_ID"
}

The ones who don't have the app will be of this form:

{
    "id": "USER_ID"
}

With FQL use this query:

SELECT 
    uid
FROM 
    user 
WHERE 
    is_app_user 
    AND 
    uid IN (SELECT uid2 FROM friend WHERE uid1 = me())


回答2:

I just answered this question here

Hope this answer helps some one down the line.