Facebook Graph API - comments from other users not showing - facebook

I'm using the Facebook Graph API and previously, using the /me/posts endpoint and including the comments field, I'd get a list of posts including all comments.
Now I've tried it again, it's not bringing back any comments unless they are my own. This is through the Facebook Graph Explorer and it's behaving the same there though so it's not my application
This is the endpoint I am using
me/posts?fields=from,message,comments
If I put .summary(1) at the end, it shows me there's, for example, 3 comments on a post but the 'data' will just be a blank area.
Has there been a change on Facebook recently in regards to this?

https://developers.facebook.com/docs/graph-api/changelog/version3.0#comments-edge
When read with a User access token, the /comments edge returns empty data for the following nodes...
A lot has changed in the last few weeks, for privacy reasons.

You need to access the comments with a Page Token, not a user or App token.

Related

How to get data regarding facebook page mentions via facebook graph api

I tried getting data using Graph API Explorer code below:
GET request:
page_id/tagged
But I'm getting only few posts. I created 2 new posts from 2 different users and tagged my page. I get mentioned notifications in my page, but it doesn't reflect in graph API.
Is there any other way to track page mentions or Am I doing it the wrong way? Also, I need the user id of the user who has tagged my page.
Could anyone point me in the right direction? I'm confused.
I was using user access token. I used Page access token, now I'm getting the data.

How to get all posts from facebook even those were geo targeted?

I'm using graph API to get posts from facebook for a specific page, but there are some posts that are targeted to a specific region and those never come in the results.
I'm requesting posts like this:
https://graph.facebook.com/FBPage?fields=id,name,link,picture,posts{message,picture,link,likes,from,feed_targeting,targeting}
That's return all posts global posts but the geo targeted ones not.
Does anyone here know if there is any possibility to filter a specific region to get those posts or even request that facebook don't take in consideration the geo target information?
SOLVED: The problem was really with tokens, to solve we got a user that has access to all pages that we need and generate a token using its credentials, that token make all the magic happens.
You can only try using a User Token, so you should get all those posts the User can see when he visits the Page manually. I assume you are using an App Token right now.
You can also try using a Page Token, in theory you should get all posts that way.

Facebook API for Share returning empty results set

I am new to Facebook API. I am building a Facebook app to fetch all the name of people who shared, commented and liked a post in a tabular format. I am able to get the like and comment details through Facebook API but can not find and proper API to get the share details.
I am using
https://graph.facebook.com/post_id?fields=sharedposts&access_token=my_access_token.
This API is returning an empty result set. And I have granted all the available permission to the access_tokn. Can anyone tell me ,Is there any other API that I can use. I saw a option of scraping the Facebook page for share,but I don't want to go that way because Facebook keeps on updating every thing.
I'm having the same problem as you, but I think I'm going a little step forward.
Try adding a limit to your sharedposts and maybe it will return some data:
Try this way:
https://graph.facebook.com/post_id/sharedposts?access_token=my_access_token&limit=1000
That should work for a regular post.
EDIT: Maybe the problem could be that althought you have granted all the perms to the token, the people who share that posts have to accept that permission too.
Otherway your JSON won't return any data.
The /sharedposts endpoint will -only- retrieve posts from users who have -also- granted your app. This means that even though a post might be public on a users' timeline, unless they have also granted your app permissions, you will not be able to retrieve that post.
For example: a user posted to a page and the post is public. This post can be retrieved with an access token. Let's assume that the user also shared this post to their own timeline. But, since the user has not granted permissions to your app, you will not be able to see this post using the /sharedposts edge on the original post (on the page). This also holds if the user shared their post publicly to his timeline.
This behaviour is by design; the API is more restrictive in returning user data than the website is. This holds for multiple endpoint and this is one of the examples where it is the case.
Source: https://developers.facebook.com/bugs/1404733043148335

Facebook Graph Api json missing posts

I am developing an web app, which connect to facebook, to get posts, and other stuff liked by users. I have problem with getting all posts from user page using news feed(home connection of Grap API).
When getting access token in my app for user, I ask for read_stream, user_activities and offline access permissions. Then, when I use that token, to get json feed for
https://graph.facebook.com/me/home/?access_token=<retrived_access_token>
some posts(which are show on user page) are missing. I found that posts of my friends, which can be seen only by their friends, are not shown in that feed. The same issue is with posts of users which current I am subscribing.
I was searching on that for a while, and I found, that when I use link from http://developers.facebook.com/docs/reference/api/ to get my news feed, there are much more posts. It's seems to use a token generated for test console app for facebook api.
Then I tried to generate access token which would give me similar results using http://developers.facebook.com/tools/explorer?method=GET. But even when I give to generated token all possible permissions I could not get it working good, there were still some missing posts.
I read answer in that post, Facebook graph API does not return all posts for user, which suggested, that this is because of permissions set by my people who publish posts, who don't want their data to be retrieved by an app. I run some quick test, and I found that changing that setting is working( when somebody change that setting her posts will disappear from both feeds - that using my app token for user, and that under link on api reference page), but it's not the case.
It seems that this token generated on api reference page have an special permission.
I really need to get as much posts from user page as possible. I know that I will not get those blocked by their author, but as many of my users subscribe other users I really need to get access to kind of posts shown on user page.
I also read Facebook graph API: feeds missing in json response but it was also not helpfull.
I will really appreciate any help.
It is impossible to get a full list of posts from the feed / home Graph API, but you can use FQL to query the stream table to get almost every post made by friends, here is a quick example of how you would do that with the javascript sdk:
var query = 'SELECT post_id FROM stream WHERE filter_key = "others"';
FB.api('fql', {'q': query}, function(posts) { console.log(posts.data); });
This will get you the post ids, which you can then use with graph api to fetch the rest of the post info. Or you can get the full list of fields here, you can't select * in FQL so you'll have to list each piece you want and then get comments and likes and names separately.
There is an assigned/medium bug on this at http://developers.facebook.com/bugs/228057243915183. You can bump up the priority by subscribing and indicating you can reproduce it.
Also see http://developers.facebook.com/bugs/231621496918030 where Facebook has said "the stream table and me/graph have limitations. See the documentation for more info. We're trying to make this more clear in the future." Personally I don't think there is really any more info in the documentation though.

How can i show the wall (feed) of my page to app on facebook?

How can i show the wall (feed) of my page to app on facebook? As i see in the page
www.facebook.com/kesha?sk=app_178091127385 and
www.facebook.com/pages/Khanduna-Yengu-Nangsu-Amuktang/187317137978077
I want show the wall(feed) of my page to my app of facebook. Please Help me.
I also try and see graph api as below
graph.facebook.com//feed
But Fail,
Please Help any one.
As I understand your question, you want to take the wall of your page and show the content of that on another page controlled by an app you have made, so that is the question I will answer.
There are a couple of things you need to do.
Facebook now requires you to have an access_token to get that information. You can get this in two different ways. Either you get your users permission to grab an access_token for them, or you create an access_token for one of the admin users with offline_access and manage_pages permissions.
There are problems with both cases:
1: Getting an access_token per user requires people to give permissions to your app which is quite annoying if they just gain access to the contents of the feed.
2: Having one access_token is also a problem seeing as Facebook puts a limit on how many requests you can make per access_token in a given time.
You need to balance these things out if you want the feed to be shown. Which case would you most likely use? If you don't have many users the second case might be the best, but if you go over the request limit no content will be shown and that could confuse your users.
Anyways.. Once you are past the access_token problem, you can access the information by getting the content from the page:
https://graph.facebook.com/YOUR_PAGE_ID/feed?access_token=YOUR_ACCESS_TOKEN.
You then get a nice json output you can use. If you are using the Javascript API you can simply use the information here:
http://developers.facebook.com/docs/reference/javascript/FB.api/
If you are ever unsure how to get the information you need there is a nice tool for that developed by Facebook called Graph API Explorer which you can find here:
http://developers.facebook.com/tools/explorer/