I wanted to fetch most popular posts from a facebook page using Graph API. I tried https://graph.facebook.com/%pageId%/posts, But with that API I am getting recent posts from page. I wanted to filter the result with most popular posts (i.e., most shared, liked and commented). Can any body help me out how to get the popular posts from the page using the graph API.
Thanks,
Siva.
You can't get popular posts directly from Facebook Graph API. You can fetch the posts using the Graph API (/{page-id}/posts), then count likes, shares or comments of a post by yourself (/{post-id}/likes, /{post-id}/comments, /{post-id}/sharedposts) and then sort all the posts.
References:
1.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/comments
2.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/likes
3.https://developers.facebook.com/docs/graph-api/reference/v2.3/object/sharedposts
Related
I like to get comments of a post by its URL but it seems its impossible by using graph API.
From my observations, I could find these types of posts URLs:
https://www.facebook.com/bbwbooks/photos/a.168788885097.122872.74209335097/10153736545150098/?type=3&theater
https://www.facebook.com/4thirteengroup/posts/1285218878169361
https://www.facebook.com/groups/semsari.malezi/permalink/1159959294084128/
or perhaps some other types.
Is there any idea, how its possible to get comments or at least the ID of the post from the url?
First use facebook developer section https://developers.facebook.com/tools/explorer/1021611514583622?method=GET&path=me%2Fposts%3Ffields%3Did%2Cobject_id%2Ccomments&version=v2.7
Select Application ,
Get access_token with user_posts access rights,
me/posts?fields=id,object_id,comments by calling this api ,you will get all posts with their comments
I am fetching posts from a public facebook page that has several contributors including myself.
When I use the graph explorer I see all of the posts, but for some reason it strips posts that I personally share when I use the PHP SDK, but includes other peoples' posts.
Here is the graph explorer with all of the posts. The first post is not included in the result set with the PHP SDK. Graph Explorer Link
Did you check the posts across all pages, since there is a pagination? There is a method called getRequestForNextPage() in the FacebookResponse class, which will create the request for the next result set.
I was wondering if it is possible to search (and retrieve the content of) a particular user's PUBLIC posts in Facebook using the facebook API - but only those posts between which contain a certain #hastag OR #mention and that fall between 2 timestamps.
We already do similar with our users' Twitter feeds using their api.
Thanks
I currently experimenting with HybridAuth and Facebook Graph API.
I get news feed from Facebook API with $fb->api()->api("/me/home?limit=10");.
But I get post with text "User likes" a photo or "User comments on status". How can I remove those posts from array with posts?
Just for notice, I get array with parameters for each post. Those posts which I want to exclude have "story_tags", and other does not have it.
Can you help me? Maybe my API call is wrong, or I should add something more in API call?
I am pulling in a facebook feed into a website I am devloping. I have got the feed to pull through but unfortunately it shows posts made onto the page by other Facebook users.
I want the feed to only show wall posts made by the page. Is this possible?
Here is the URL i am using to pull in the feed:
https://graph.facebook.com/HadleighSwimmingPool/feed?access_token=292423037531408|0cc972ba47bcdafed97f3d01a2a3bd77&limit=1
Thanks
As #CBroe said, you can use Facebook Query Language.
Here's the FQL query you need:
SELECT message FROM stream WHERE source_id=[page-id] AND actor_id=[page-id]
For testing you can use the graph api explorer tool.