Why I don't see my facebook friends in graph explorer - facebook

When in Facebook Graph Explorer I executed /me/friends command from docs, I get next response:
{
"data": [
],
"summary": {
"total_count": 68
}
}
So, based on response, I have 68 friends (it's true), but data array is empty, and I don't see my friends in array.
What I do wrong? I think, maybe I need to config my application? but I don't know what exactly t config. Help, please

With the new Graph API (v2.0), your application must ask for the user_friends permission in order to retrieve friends. Additionally, this new permission now only returns friends who also use the same application.
If you want to get the complete friends list for tagging / invite purposes, there are two new APIs you can use: /me/taggable_friends or /me/invitable_friends - the latter is only available to Games.
See this tutorial for more information.

Related

Facebook graph api me/events returns blank

I'm using the Graph API Explorer and have given permissions for user_posts, user_likes & user_events.
me/posts and me/likes return non-empty data, but me/events returns this:
{
"data": [
]
}
I do have ongoing and upcoming events (interested) and they are visible on my Facebook profile.
Any idea what's going wrong? Or is it a Facebook bug?
https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes
Testing of our more robust process starts today and the new process
should resume in a few weeks, but apps currently accessing Events and
Groups APIs will lose access today.
This may also be interesting for you: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#events-4-4

How to display "from" fields in comments via Facebook Graph API

I would like to find the id (app-scoped) for someone who has posted a comment on a public page.
For example, I get a list of recent posts/comments on the NY Times page via:
v2.11/nytimes/feed?fields=comments.limit(10){message,created_time,from},name,message,from&limit=2
The data returned looks like this:
"comments": {
"data": [
{
"message": "Wouldn’t know. Not paying $13/mo for this.",
"created_time": "2017-12-10T05:57:18+0000",
"id": "10151412260164999_10151414049324999"
}
],
There is no from field. The same is also true if I attempt to view the comment directly using it's id with
v2.11/10151412260164999_10151414049324999?fields=from,message,created_time
I have tried using the Facebook Graph API Explorer, using both my User Token, as well as an App Token.
Since v2.11 of the Graph API, you need a Page Token to get user data of comments: https://developers.facebook.com/docs/graph-api/changelog/version2.11#gapi-90
User information will not be included in GET responses for any objects owned by (on) a Page unless the request is made with a Page access token. This affects all nodes and edges that return data for objects owned by a Page.
In other words: You can only get user information if you manage the Page.
Edit: Since the latests update in the Graph API, you have to get the App reviewed and you must go through Business Verification or Individual Verification. (thanx #Guiman04)
Please check whether you are using the accessToken for the page you are trying to get data from, i had same issue, and was resolved by using the correct accessToken for the page.

Facebook friends request returns empty -- despite permissions [duplicate]

This question already has answers here:
Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application
(8 answers)
Closed 6 years ago.
I'm building a Rails backend for an iOS app. The backend needs to interface with Facebook to grab and use each user's Facebook friends.
But the Facebook 'friends' request is returning empty.
I'm essentially making the following request:
curl https://graph.facebook.com/[FILTERED_USER_ID_FOR_APP]?fields=friends&access_token=[FILTERED]&debug=all
I've looked at a ton of StackOverflow posts about this (this one, and this one, and this one, and more), but haven't found an identical problem or a solution that fits.
I seem to have set permissions correctly. Both on the Rails app and when the user authenticates through the iPhone app, I've set user_friends to be one of the permissions, and, in fact, when someone registers now, it asks them to OK the user friends permission.
But when I actually request their friends, I get a response telling me that there are many friends, but not returning any of them. The below response is for a user who definitely has friends on the app.
{
"data":[],
"summary": {
"total_count": 419
},
"__debug__": {
"messages": [
{
"link": "https:\/\/developers.facebook.com\/docs\/apps\/versions\/",
"message": "No API version was specified. This request defaulted to version v2.7.","type":"warning"
},
{
"link": "https:\/\/developers.facebook.com\/docs\/apps\/changelog#v2_0",
"message": "Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.",
"type": "info"
}
]
}
}
What's perplexing to me is that a) The App ID/User ID/Access Tokens seem right, because I can get basic profile info, and b) I do not get an error telling me that the request doesn't have the proper permissions. If I make a similar request without permissions on the explorer, it returns a relevant debug note:
{
"message": "The field 'friends' is only accessible on the User object after the user grants the 'user_friends' permission.",
"type": "warning"
}
If I make it with the right permissions in the explorer, it returns a list of friends (in the data array).
So it doesn't seem to be a permissions issue, but the request is returning an empty friends list. Any ideas?
With Igy's help (pointed to this answer), I found the specific answer to my issue, which seems worth adding here.
The problem was that the new 2.0+ API version only returns friends:
Who are on the app
Who have agreed to the user_friends permissions themselves.
1 was all figured out, but because I'm still testing the app out, and nobody had yet accepted permissions, my test user was the only person who had accepted permissions. Nobody else had accepted user_friends, so nobody showed up as a friend of the test user. Getting a friend of the test user to add the permissions fixed the problem, adding that friend to the list of friends returned.

Facebook Friends in each Friendlist

How can I get a list of friends along with their friend_list_type?
I tried to get all the list_types by making the following call:
https://graph.facebook.com/[USER_ID]/friendlists?access_token=ACCESS_TOKEN
On receiving this, I tried ti iterate over the list_types and make the following call to get the list of friends on each list_type:
https://graph.facebook.com/[FRIEND_LIST_ID]/members?access_token=ACCESS_TOKEN
But, I always get an empty array in response, like this:
{
"data": [
]
}
I am sure that the user is having friends mapped to multiple friend_list_types. But, still I am getting NO result. Is there anything which I am not aware of?
Note that, I tried this on all versions of Facebook Graph API and I also have read_friendlists permission to access the user's friend_list.
The friendlists endpoint is only a list of the friendlists, there is no way to get the friends in those friendlists.
Think of it this way: What if someone creates a list called "Idjits" and puts some friends in it. No App should be allowed to read that kind of information ;)

Can't access news.reads actions using facebook open graph api

I have a facebook account I KNOW has articles posted to the open graph as read actions under the news.reads global namespace (I can see them under the News aggregation in my timeline) but when I try to get a list of them using this api address:
https://graph.facebook.com/me/news.reads?access_token=[my access token]
it returns:
{
"data": [
],
"paging": {
"next": "https://graph.facebook.com/me/news.reads?access_token=[my access token]&offset=25&limit=25"
}
}
as though there were no articles posted at all. I checked my permissions and cant find anything that might be causing this issue. Anyone know how I should be accessing this data correctly? Thanks!
You need the user_actions.news Permission in order to access the user's list of news reads, otherwise the array comes back empty