How to get reactions count for all posts on public page? - facebook

I'm stuck with one thing.
How can I get reactions count for public page?
For example I have a page with 100 posts, each post have 10 reactions.
Which query I should run to get something like that:
{
"reactions_count": 1000
}
I've found only one way to do it with reactions per post with this query:
/feed?fields=reactions.summary(total_count).limit(0)
But if the page has a large amount of posts it would be quite hard to get total reactions count for all posts.
Thanks!

Related

How to get counts of grouped related items in prisma?

I have a table of Posts and a table of Reactions. A reaction is a tuple of [userId, postId, reactionType] where reactionType is an enum of "like", "thumbsup" and so on. So when a user "likes" a post, it adds a "like" reaction to the reaction table.
What I want is to query a list of posts, and for each post I want to get the count of reactions of each type. So for post A I would have 3 likes and 1 thumbsup, for post B I would have 0 likes and 2 thumbsup and so on. I don't want to get the actual reactions themselves because there could be potentially thousands of reactions for each post, I just want to get the count.
Is there a way to express this in Prisma, or do I need to dive down to raw SQL? I'm using PostgreSQL as the underlying db.

How to get shares count for a Photo in Facebook?

I want to get comments count, likes count and shares count for a page posts. I have their IDs and I'm trying to figure something out with the Graph API or FQL, but in vain.
For regular posts I can query the stream FQL table and I get the comment_info, like_info structures and shares_count variable.
For posted photos I can query the photo table and I get from there comment_info and like_info, but it lacks the shares_count.
I tried using Graph api like that: GET /550045508388715 and it returns a ton of information, but nothing related to share count.
I've googled that issue, but did not found any relevant solution.
Instead of GET /ID use GET /POST_ID to get the shares count (if >1). You'll get the result as-
"shares": {
"count": x
}
Note- the Post ID is generally: USERID_PHOTOID ORPAGEID_PHOTOID

Search Facebook Graph API for long posts?

Is it possible to search the Graph API for posts a Facebook member has written where post.length > n ?
Or would I have to pull posts and parse/filter them in my code?
You can use FQL to make filtered Graph API calls.
This query will get you posts with a message containing the word "this" which are more than 50 characters long.
SELECT message, post_id FROM stream WHERE CONTAINS("this") and strlen(message) > 50 LIMIT 100
The CONTAINS() function is not documented. From my experimentation with it, it searches multiple fields and is optimized to return matches that are based on full names.

Facebook API get number of posts?

Given a page access token, how can get the total number of posts day by day?
You can query the FQL insights table: http://developers.facebook.com/docs/reference/fql/insights/
the insight you're looking for in in the Page Content section of that link.
However, that is an insight that is being deprecate on 2/15. So be sure to get your data quick. It's being removed from Facebook. I don't know why.
You can only retrieve a summary/count for published posts on a page. Something like this will work when querying the Page directly:
{PAGE}?fields=published_posts.limit(1).summary(total_count).since(1)
The response will look something like:
{
published_posts: {
summary: {
total_count: 12345
},
...
}
}
or if you want to query the published_posts directly, use:
{PAGE}/published_posts?limit=1&summary=total_count&since=1
The response will look something like:
{
summary: {
total_count: 12345
},
...
}
Setting limit to 1 ensures that your query is not unnecessarily large. If you're just needing the total post count, then set limit to 1.
The since parameter is a unix timestamp (milliseconds since January 1, 1970) and is required to retrieve the total post count. Set this to 1 as setting it to 0 will throw an error.
More details: https://developers.facebook.com/docs/graph-api/reference/page/published_posts/

FQL return 0 as like count for few pages

While running FQL query for retrieving page like count, i get 0 count for few pages. For most pages count comes fine but for few its always 0
Steps to reproduce:
Hit the following query:
https://graph.facebook.com/fql?q=SELECT+url,normalized_url,share_count,like_count,comment_count,total_count,commentsbox_count,comments_fbid,click_count+FROM+link_stat+WHERE+url+IN+(select+page_url+from+page+where+page_id+in+(344556287396,127535033990841,77277900503,293373084463))+
Expected Behavior
Correct like count should be returned:
http: //www.facebook.com/heyne.verlag (16,546)
http: //www.facebook.com/nwbVerlag (3,422)
Actual Behavior:
0 count is returned
I have checked with 150 pages, and find that FQL return 0 like count for 50+ pages. Please help me to fix this issue
This was by design. I was querying links of pages that are on Facebook.
link_stat reflects the interaction of users with a website, e.g. example.com. I made to query the page table in order to get the like count and was able to get correct count