Can I retrieve info from users that are not friends of the authenticated user?
I'm just starting with Facebook Development and have a basic question开发者_Go百科. Can I retrieve info from users that are not friends of the authenticated user? For example, retrieve all facebook users that live in New York.
For privacy reasons, you cannot retrieve info for arbitrary users, so you cannot get info for users that are not friends of the authenticated user. If you know a user's username, you can get some basic information, such their facebook ID, first and last names, gender, etc. by querying https://graph.facebook.com/USER_ID, e.g. https://graph.facebook.com/dhirenp
With the friends_hometown
extended permission you can retrieve the home town for a user's friends. With the friends_location
extended permission you can retrieve their currently listed city.
You should also be able to query for a list of a user's friends who live in a particular city by querying the User FQL table ( https://developers.facebook.com/docs/reference/fql/user/ )
Check https://developers.facebook.com/docs/reference/api/user/ which lists all fields available for a user object and the permission necessary to retrieve it for the current user and their friends (where applicable - some permissions can not be given on behalf of a users' friends)
[but yes, as Dhiren says, this is only applicable for users that have authorised your app, or are friends with someone who has authorised your app (with the appropriate permissions) - there isn't a way to arbitrarily search like that]
精彩评论