3
votes

I was using fql to get link stats like this:

 https://graph.facebook.com/fql?access_token={token}&q="SELECT share_count, like_count, comment_count, click_count,url FROM link_stat WHERE url=http://someUrl.com"

And the response is:

{
"data": [
  {
     "share_count": 1,
     "like_count": 2,
     "comment_count": 1,
     "click_count": 0,
     "url": "http://someUrl.com"
  }
 ]
}

So because fql is deprecated I need to do this with graph-api, but I didn't find anything what would do this job. There is URL graph-api:

https://developers.facebook.com/docs/graph-api/reference/v2.5/url/

I tried this:

https://graph.facebook.com/v2.5/?access_token={token}&id=http://someUrl.com&fields=id,og_object{engagement},share

And for the same Link response is:

{
"id": "http://someUrl.com",
"og_object": {
  "engagement": {
     "count": 3,
     "social_sentence": "3 people like this."
  },
  "id": "878377855594880"
},
"share": {
  "comment_count": 0,
  "share_count": 3
}
}

So there are several issues:

  1. It doesn't return click_count

  2. It doesn't return like_count (there is value under engagement.count). Regarding to documentation this should be number of likes. But the value is not correct, as you see from my FQL response "like_count=2" what is correct, but in graph API "engagement.count=3" so it's not correct.

  3. comment_count returned from graph api is not correct. It says 0 comments, but as you can see from FQL response it has 1 comment what is correct

  4. share_count returned from graph api is not correct. It says 3 shares, but as you can see from FQL response it has 1 share what is correct.

So is there any way to get the same results (correct results) with graph API like I am getting them with FQL call.

The only solution I found without fql is FB Rest API, like this:

https://api.facebook.com/method/links.getStats?urls="http://someUrl.com"&format=json

But this one is also deprecated.

1
1.0 REST API also returned detailed statistics, containing likes and comments. Unfortunately FB decided to merge all social interactions with the link together into one statistic - share count, which is equivalent with FQL's total_count field - likes, shares and comments summed. As a side note, there is another issue with those numbers - it seems only interactions occurring within some time period are counted, with older data getting lost. So for some links I've observed decline in numbers returned by API over time. This is not explained anywhere in API reference. - jkondratowicz

1 Answers

3
votes

Unfortunately you are not able to implement this using graph-api at this moment. I stumble upon to the same issue and it seems that there is an issue on facebook side. Bug is reported on February and marked as "Bug Confirmed". Fix is still pending.

To check status click here.