简体   繁体   中英

Facebook graph-api get link stats

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM