How to get Facebook page posts count on Android using Facebook SDK - facebook-graph-api

I am building an app, which lists all posts from a Page(that I manage and post to) and also gets corresponding posts view count. I looked into the documentation and it seems like the page needs a minimum of 30 Likes for insights API to work. Is this correct? Is there a way I can get the view count?
Here is the output from Graph Explorer. I have set the access token to Page Access token.
I am passing the Post_ID to HTTP GET. I can see directly from Facebook that the post has reached N number of people. But the returned data from the API call is empty. Any help?

Related

How to determine why a facebook page URL will not return a facebook id?

For the most part, using the graph api, passing in a Facebook page's encoded URL returns the normal facebook id.
For instance, using the Graph API Explorer and passing in https%3A%2F%2Fwww.facebook.com%2Fkendalljenner returns
{
"name": "Kendall Jenner",
"id": "173567062703796"
}
However, for some (pretty rare) FB pages, like http%3A%2F%2Fwww.facebook.com%2Fmargotrobbie, I get
{ "id": "http://www.facebook.com/margotrobbie" }
The question, Why do some Facebook urls not return their Facebook page id through graph api?, suggests that the issue may be that the page is restricted somehow (like for alcohol content). I believe this may be the case, because the Harley Quinn videos in the posts are a bit graphic, but I searched all the info for the page and it doesn't say anything about the content being restricted. In addition, I am using a User access token that is allowed to see the page via normal FB web interface without any apparent restriction.
BTW, for anyone who hasn't seen this before, the id set to the url seems to be the result when facebook doesn't know anything about the URL. Obviously this shouldn't be the case for facebook's own URL.
Not sure what the reason for the apparent difference with the two page URLs indicated, but I did solve the underlying problem of getting the facebook id of the page!
First of all, I had tried the process described here: How to get page id of facebook page, however it wasn't working for me. In my effort to permute all options, I had changed the access token to a "user access token". Turns out, you HAVE to have an "application access token" as is well-documented in said article.
Thanks to CBroe for making me question how I was calling the API...no matter how long I was calling it this way.

Facebook Graph API get likes/reactions

I'm trying to fetch some data from page posts on Facebook with the Graph API. I'm using Python normally but I try the queries first with the Exploration tool offered by Facebook.
I used the page_id + post_id to get the number of reactions (I would also like to get the count for each different reaction) and likes. But it just returns nothing. I get the data for the shares though. I have the post open on another tab and it has likes and reactions.
Don't know what I'm doing wrong.

Facebook OpenGraph: Getting like count of post without User Token

I have an existing app that uses the Facebook API & login that makes posts to the user's wall. For each post I store the id of that post.
What I need to accomplish is to gather like counts of those posts generated by the first app. I'm trying to write a small app that routinely pulls the like count. I've figured out how to get the like count of the post if I use a User Token - via Facebook Login. But since this app will run as a batch and not by a human, I don't want to use a Facebook login page. I could write code that simulates a user logging in but that would be a major ugly hack. I've tried to use an App Token but then the like count is always zero. I've found how to get the like count of a page without the need for a User Token http://www.techrecite.com/get-facebook-likes-count-of-a-page-using-graph-api/ but not a post
Is this even possible? If so how?
I've looked into Facebook API's subscription, but it doesn't seem possible to subscribe to a "like-a-post" event. Although I could be wrong. If so, could someone point me in the correct direction.
Thanks.

How to get general data from facebook graph api

I'm looking into the facebook graph api. I understand that I can retrieve information about a facebook web page by making a get with the current id. It's also clear that after retrieving a access token I can post on the logged in users wall and do other operations.
But what if I want more general data? Can I, for example, get how many swedish user who have used the word "Obama" in their status update the last week?
I don't think that the current search API can be that specific. You can find everything about the search API in this document.

Montreal Canadiens Facebook Graph API returns no posts

I'm using the Graph API to return Facebook posts from all NHL teams. Every team returns the posts fine except for the Montreal Canadiens, which returns no posts. I verified that there are posts on their wall, and that the Facebook ID that I used is correct(see here)
I get back an empty JSON list when I try using this link for the Canadiens:
https://graph.facebook.com/110877132302973/posts?access_token=(my access token)&limit=10
Any help would be appreciated! Thanks.
Haotian
The posts on that page all have a custom privacy setting - you need to make sure you're attempting to access them using a User access token for a user that meets whatever restrictions they've applied.
App or page access tokens won't be able to see the posts, nor will user tokens for users who don't meet the restrictions