Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get most popular posts from facebook page using graph API

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.

like image 371
Siva Avatar asked Feb 02 '26 17:02

Siva


1 Answers

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

like image 151
Muhammad Sumon Molla Selim Avatar answered Feb 05 '26 07:02

Muhammad Sumon Molla Selim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!