Talk:Friends.getAppUsers
From Facebook Developer Wiki
[edit] Documentation Inadequate
This method needs better documentation:
* Method doesn't exist in the API Test Console * The "equivalent" FQL query (as typed into the test console) returns something very different * There is nothing showing example JSON results (which, by the way, are [123,456,789] )
[edit] Sort Order?
At the moment the results seem to be ordered by FB Id. Is there an easy way to get this list sorted by name, without making additional API calls?
- I use FQL to do this. in PHP it looks like:
$query = "SELECT uid FROM user WHERE is_app_user = 1 AND
uid IN (SELECT uid2 FROM friend WHERE uid1 = $uid) order by concat(first_name,last_name) asc";
$users_info = $api->fql_query($query);
$friends = array();
foreach($users_info as $user_array){
$friends[] = $user_array['uid'];
}
return $friends;
- This has the added advantage of returning an empty Array if there are no app friends, as opposed to the empty string "" that the FB API gives you in PHP. 11313545 10:19, 2 September 2009 (PDT)
[edit] This doesn't seem to return anything is the app is not authorised by the current user?
Is that the intended behaviour? I assumed this would be ideal for showing a panel of your friends already using this application, - therefor you should authorise it too!
Is this not what the method is intended for?
- JH
- Right, you need a session key in order to make this call, and to get a session key, the user has to have authorized your application or connected to your site. It's used when a user authorizes your app/site, you can make this call and immediately know which of that user's friends use your app/site, and you can then tailor the content accordingly (set up a leaderboard, for example). The use case you cite is what requests and invites are for. Pete -- 563683308 09:22, 20 October 2009 (PDT)
