facebook graph API endpoint for getting “likes, shares, comments” for post(s)

后端 未结 4 1662
长情又很酷
长情又很酷 2021-01-31 19:26

Facebook is planning to drop support for FQL after V2.0 https://developers.facebook.com/docs/apps/changelog/#v2_0_fql

The below task could be done easily with FQL

4条回答
  •  悲哀的现实
    2021-01-31 19:46

    Get comments, shares, and likes count from post:

    [POST_ID]/?fields=id,shares,likes.limit(0).summary(true),comments.limit(0).summary(true)

    I've included limit(0) to prevent the API from spitting out the actual comments and likes. I believe the default limit is 25.

    Please note you can also add these fields to /feed to get this data for all the posts on the page.

    [PAGE_ID]/feed?fields=id,shares,likes.limit(0).summary(true),comments.limit(0).summary(true)

    Final note: If shares data is missing on the return, it is because the post has no shares. Instead of returning "shares": {"count": 0}, the shares section will be removed entirely.

提交回复
热议问题