Facebook Graph API. How to get likes for comment?

2019-07-06 02:51发布

I need to get ids of people who liked some comment.

For example, I have the post with id 246595548763188_464132103676197 , and this post has comment with id 464146663674741.

Then, I use Graph Api Explorer (https://developers.facebook.com/tools/explorer/)

Permissions: user_groups

Graph API URL: https://graph.facebook.com/464146663674741

Result:

{
  "id": "464146663674741", 
  "from": {
    "name": "Rostyslav Paranko", 
    "id": "100001288191932"
  }, 
  "message": "Українську мову доконають пуристи.", 
  "can_remove": false, 
  "created_time": "2013-06-03T19:10:57+0000", 
  "like_count": 8, 
  "user_likes": false
}

As you can see, like_count has value 8, but I can't see people who liked this comment (with ids and names). https://graph.facebook.com/464146663674741/likes returns empty array.

So, is it possible to get comment's likes using Graph API (or, maybe, FQL Query)?

1条回答
一纸荒年 Trace。
2楼-- · 2019-07-06 03:46

Get the comment ID and make this Graph API request:

https://graph.facebook.com/COMMENT_ID?fields=likes

The comment ID is in fact the concatenation of:

  • the POST_ID (246595548763188_464132103676197),
  • the COMMENT_ID (464146663674741),

which would give in your case: 246595548763188_464132103676197_464146663674741.

So, this should work:

graph.facebook.com/246595548763188_464132103676197_464146663674741?fields=likes

查看更多
登录 后发表回答