Is there a simple way to get the number of likes on posts on a page from the facebook graph API. My current Aproach is to get the feeds of the page, and then for each individual post get the ammount of likes.
So First I itterate all the posts on
--This make this a ton of times as I can only retrive 100 at a time
/{page-id}/feed
And then using each post ID
--Make this request even more times
/{object-id}/likes?summary=true
But this is horribly inneficient and takes a lot for each page.
So basically the question is, can I get the info making less requests?
This works for me:
/{page-id}/posts?fields=message,likes.limit(1).summary(true)
Related
Is it possible to specify a time span for the posts returned by GET /v2.x/{page-id}/feed?
For example, I want all the posts of the last hour and only those...
EDIT: Just found the since and until fields for the feed. However, this only seems to apply to posts, not to comments on those posts...
Any way to apply the time span to both posts and comments, regardless?
Ideally, I would get a chronological list of messages (whether posts or comments) for the last X time units.
Graph API returns comments in same order as selected on actual post|picture|etc..
I already searched alot about this. Then i went for a stupid but simple solution. I can show you if you are willing to made 2 requests to graph api to get comments
I was reading the fb api doc but I couldn't find a lot about the different type of queries you can build.
Im trying to count all the likes in the posts from certain facebook page of the day.
Does the API supports params like the date or Will I have to take a whole response like the one I get with this request and somehow sum the counts of the likes?
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)&access_token=XXXXXXX
Thanks
most graph api queries support a since, until params
you can try this based on your example
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)&access_token=XXXXXXX&since=2015-08-25&until=2015-08-26
I am trying to get user likes in facebook. I can only get 100 at a time for some reason. i tried using the limit parameter in open graph syntax and it didn't help. I alwso tried writing an FQL query to get more likes and to no avail. No matter what I do, i get only 100 likes per request. It's even worse. Most of the likes are of no interest to me. I'm using only likes on several categories. if i could have gotten (using FQL) 100 likes of a user which are all of those categories, that would have been sufficient to me. But when I call the FQL query it seems that FB is querying on 100 first likes and returning the results instead of returning 100 results. I am despaired at this mechanism, is there a way out of this or is FB really gave no way to get more likes in a single call?
Read about paging in the docs: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2?locale=en_GB#paging
I guess the max limit is 100, if you want to get more than that you have to make another call by using paging. There is no way to filter with the API, you will have to do that on your own after getting the likes.
Here's the problem I'm having -- I want to pull the latest 20 wall posts from a company's Facebook page using Graph API, but only those posts that were authored by that company. For instance, if I were pulling from the Grey Poupon Facebook page, I don't want any of the wall posts that their fans put up, just the ones that Grey Poupon put up.
From my vantage point, there's no way to do this, other than by pulling way too many, then cycling through each result and checking the "from" data to make sure it matches the page name till that limit hits 20. But that's awfully inefficient and still doesn't guarantee a result set of 20. Am I missing something, or is that my only option?
What exactly are you requesting from the API – /pageid/feed, or /pageid/posts …?
The latter should only contain the page’s own posts.
Also, you could use the FQL stream table to filter by actor_id.
I have a application that monitors a businesspage for you, along with other sources like Twitter. For the purpose of internal comments and analytics I store the posts on the wall in our database.
Every 10 minutes I ask Facebook if there are new posts since the last time. I use "/me/feed?since=[10 mitutes ago]". The problem is when I have already stored the post and a new comment is added to this post, when I request the new posts this post is not returned.
I know this is because the created time is before the timestamp requested in the since call. But the updated time is not. Is there a way to set 'since' to the updated time in stead of the created time?
Extra case information
I also tried this using FQL instead of Graph API. But that method has a problem/bug.
I use this script on the pages of very large companies, like Heineken. On these pages, there are a few posts per hour and on busy times many posts per minute. But those are not the problem.
The problem is that I have a few posts, usually one or two a day, that are very interesting and have a lot of comments, and continue to have comments for days. Those 'large' posts are the most interesting of all, but they get suppressed out of my results because there are too many new posts.
Use FQL:
SELECT post_id FROM stream WHERE source_id = me() AND updated_time > YOUR_TIME_LIMIT
This gives you all posts to a user's wall (source_id = me()) which were updated after a certain time. The "updated_time" is changed when a user comments on the post.
To add fields to retrieve with the query, please have a look at the fields in the FQL stream table.