Facebook 'Friends.getAppUsers' using Graph API
I have an application that uses the old REST API call Friends.getAppUsers
to get the list of friends for the current user that have authorized my application.
I have read the documentation, how do I do this with the Graph API? What would an example of this be?
I searched around for a while, and I too thought this wasn't possible using Graph API.
However, I posted a similar question, Replacement for old GetAppUsers call to see a user's friends who use my application?, for the specific API I was using and was given a great general answer.
https://graph.facebook.com/me/friends?fields=installed
or more generally
https://graph.facebook.com/{user id}/friends?fields=installed
This returns all friends, with the additional field "installed=true" for those friends who use the application.
Here is it working in the Graph API Explorer:
This can be done with FQL.
SELECT uid FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = ?)
AND is_app_user = 1
QED!
Yes, the Graph API is horribly documented. I don't see any documentation for an "application" type, but they do reference an application's info in the docs:
https://graph.facebook.com/2439131959
So, perhaps you can get the application's members using the Group syntax?
https://graph.facebook.com/2439131959/members
You'll need an authenticated session to test it. Otherwise, it looks like Facebook is pushing us to use FQL to send queries directly:
http://developers.facebook.com/docs/reference/fql/application
You can execute FQL queries by fetching https://api.facebook.com/method/fql.query?query=QUERY. You can specify a response format as either XML or JSON with the format query parameter.
So you can pass a FQL query to get information about your application.
Old REST API:
$facebook->api_client->friends_getAppUsers();
New Graph API:
$facebook->api(array('method' => 'friends.getAppUsers'));