Reputation: 101
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.
Upvotes: 3
Views: 3836
Reputation: 4099
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
Upvotes: 5