how to get all my facebook application users?

2019-04-10 10:35发布

问题:

I want to get the list of users who have connected to the app. Is there a way to do it using FQL or Graph API?

回答1:

With FQL, just do :

$fql="SELECT uid FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = ".$me['id'].")
AND is_app_user = 1";

This is self explanatory.

AFAIK, its not possible via GRAPH API



回答2:

I used this and works fine. This will get you a lists of your friends who have approved the app, not all the users

function getUsersApplication(){
    var url = "https://api.facebook.com/method/friends.getAppUsers?access_token="+FB.getAccessToken();
    $.ajax( {
        url : url,
        type : 'GET',
        dataType : 'text',
        data : null,
        success : function(data) {
        alert(data);
        }
    });
}


回答3:

This works for me, here is an AS3 example:

var fql:String = "select pic_square, uid, first_name from user where is_app_user = 1 and uid IN(SELECT uid2 FROM friend WHERE uid1 =" + Facebook.getSession().uid + ")";