Get ALL User Friends Using Facebook Graph API - Android
In v2.0 of the Graph API, calling /me/friends
returns the person's friends who also use the app.
In addition, in v2.0, you must request the user_friends
permission from each user. user_friends
is no longer included by default in every login. Each user must grant the user_friends
permission in order to appear in the response to /me/friends
. See the Facebook upgrade guide for more detailed information, or review the summary below.
The /me/friendlists
endpoint and user_friendlists
permission are not what you're after. This endpoint does not return the users friends - its lets you access the lists a person has made to organize their friends. It does not return the friends in each of these lists. This API and permission is useful to allow you to render a custom privacy selector when giving people the opportunity to publish back to Facebook.
If you want to access a list of non-app-using friends, there are two options:
If you want to let your people tag their friends in stories that they publish to Facebook using your App, you can use the
/me/taggable_friends
API. Use of this endpoint requires review by Facebook and should only be used for the case where you're rendering a list of friends in order to let the user tag them in a post.If your App is a Game AND your Game supports Facebook Canvas, you can use the
/me/invitable_friends
endpoint in order to render a custom invite dialog, then pass the tokens returned by this API to the standard Requests Dialog.
user_friends
permission).For apps wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the new Message Dialog on iOS and Android.
How to get whole Facebook friends list from api
The friendlists endpoint is deprecated, as you can see in the breaking changes log: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#tagged-users-4-4
It would not have been what you expected anyway, it was only for lists, not friends directly. Access to all friends is not possible since a very long time. You can only get data of users/friends who authorized your App. You can use the /me/friends
endpoint for that.
Another thread about getting all friends: Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application
Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application
In v2.0 of the Graph API, calling /me/friends
returns the person's friends who also use the app.
In addition, in v2.0, you must request the user_friends
permission from each user. user_friends
is no longer included by default in every login. Each user must grant the user_friends
permission in order to appear in the response to /me/friends
. See the Facebook upgrade guide for more detailed information, or review the summary below.
If you want to access a list of non-app-using friends, there are two options:
If you want to let your people tag their friends in stories that they publish to Facebook using your App, you can use the
/me/taggable_friends
API. Use of this endpoint requires review by Facebook and should only be used for the case where you're rendering a list of friends in order to let the user tag them in a post.If your App is a Game AND your Game supports Facebook Canvas, you can use the
/me/invitable_friends
endpoint in order to render a custom invite dialog, then pass the tokens returned by this API to the standard Requests Dialog.
user_friends
permission). This has been confirmed by Facebook as 'by design'.For apps wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the new Message Dialog on iOS and Android.
UPDATE: Facebook have published an FAQ on these changes here: https://developers.facebook.com/docs/apps/faq which explain all the options available to developers in order to invite friends etc.
searching friends using facebook graph api
You can get the list of friends using the following API call:
Friends: https://graph.facebook.com/me/friends?access_token=...
and then search in the list for the person you are looking for.Refer to more detailed documentation here: http://developers.facebook.com/docs/api
Get facebook friends posts using graph API
friend permissions are gone, and read_stream
will not get approved by Facebook unless you are building an App for a platform without a native Facebook client. So there is no way to get access to friend walls - unless they authorize your App too. You can use user_posts
for that.
You can read more about all the changes in the changelog: https://developers.facebook.com/docs/apps/changelog
Facebook improved privacy for users, that´s why you can´t get any details of users who did not authorize your App.
Facebook Graph API - Friends using application
You should be able to do this with FQL:
select uid, name, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1
How to invite friends to facebook app via the Graph API
So it turns out, thank to CBroe's comment that it is not possible to invite via the Graph API (I wish it were clearer in the documentation).
It is not necessary, however, to use the friend select dialog. It is possible to generate your own list of friends using either the graph api, server-side or client-side and produce a confirmation box by using the JS SDK like so:
$('form').on('submit', function(e) {
e.preventDefault();
var userIds = $(this).find('input:checkbox:checked').map(function() {
return parseInt($(this).val(),10);
}).get();
FB.ui({method: 'apprequests',
message: 'Check this app out!',
to: userIds
});
});
Related Topics
PHP - Simplexml - Addchild with Another Simplexmlelement
Php: Fastest Way to Check for Invalid Characters (All But A-Z, A-Z, 0-9, #, -, ., $)
Converting Nsarray -> JSON -> Nsdata -> PHP Server ->JSON Representation
Flip (Transpose) the Rows and Columns of a 2D Array Without Changing the Number of Columns
Deny Direct Download of File Using PHP
Object Copy Versus Clone in PHP
Laravel Customized Session.Lifetime at User Level
Get User Data Using Access Token in Laravel Passport Client App
Paypal Ipn Bad Request 400 Error
Php/MySQL with Encoding Problems
PHP Search Array Key and Get Value
Save CSV Files into MySQL Database
Yii Framework: Using Data from Related Active Record Models for Searching
How to Pass an Array of Checked/Unchecked Checkbox Values to PHP Email Generator
Png Transparency Resize with Simpleimage.PHP Class