views:

25

answers:

1

I'm really struggling with something that should be a simple matter: Showing a user of my Facebook app a list of their friends also using the app. Is there nothing built into the APIs to allow such a common request?

The only thing I can think of to do is to get the list of the user's friends, and then get all the users from my database who are in that list, and then fetch information for each of those facebook ids. But that seems an extremely roundabout way of doing things...

+2  A: 

The only way I've found to do this is to use FQL and a previously documented, but now undocumented field:

SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=<user's uid>) AND is_app_user=1 ORDER BY name

The undocumented field is the user.is_app_user, which is listed in the old documentation wiki but not in the shiny new docs. No idea if this means it'll be removed in the future, but there doesn't seem to be any other way to get this data with the new Graph API.

Just in-case you're still using the old REST API, you can also call the friends.getAppUsers method.

Cyphus
I didn't realize that parameter still existed. I guess I'll be using that.Quick question though, how do I call an FQL query using the new PHP api?I tried calling `$facebook->api('/fql.query?query=...')` but it told me "Some of the aliases you requested do not exist: fql.query" which I guess is because you're supposed to call that from api.facebook.com, as opposed to graph.facebook.com, but I'm unsure how to fix it.
death_au
Never mind, I found it. `$facebook->api(array('method' => 'fql.query', 'query' => $query))`
death_au

related questions