質問

How do I get the links posted in a Facebook page AND the # of likes that link got without making extra calls?

Right now I am making this call, and it gives me all the posts that are links, posted in a Facebook page. How do I get the like count for each post? I simply want to know how many people liked that post.

https://graph.facebook.com/#{facebookId}/links?access_token=TOKEN&limit=20
役に立ちましたか?

解決

To get the likes count for each post that is a link, the following query:

https://graph.facebook.com/#{facebookId}/links?fields=likes.limit(1).summary(true)&access_token=TOKEN&limit=20

gives you a response like this:

{
  "data": [
    {
      "id":
      "created_time:"
      "likes": {
        ...
        "summary": {
          "total_count": 23
        }
      }
    },
    {
     ...
    }
  ]
}

The total_count value is what you want.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top