1
votes

Getting notification from FB, they will remove FQL inthe later release after 2.0 which is expect to be on 2016.

Currently my Apps are using FQL to get the like_count and share_count. I hope someone can share with me how to achieve this in GraphAPI2.0 because in GraphAPI, I only able to retrieve the total count.

https://api.facebook.com/method/fql.query?query=SELECT%20url,%20share_count,%20like_count,%20comment_count,%20total_count,%20click_count%20FROM%20link_stat%20where%20url=%27http://www.google.com%27

<fql_query_response list="true"><link_stat>
<url>http://www.google.com</url>
<share_count>5860640</share_count>
<like_count>1446662</like_count>
<comment_count>1775201</comment_count>
<total_count>9082503</total_count>
<click_count>265614</click_count>
</link_stat></fql_query_response>

http://graph.facebook.com/?id=http://www.google.com

{
   "id": "http://www.google.com",
   "shares": 9082503
}
1

1 Answers

1
votes

The more up to date way of using your FQL would be

https://graph.facebook.com/fql?q=SELECT%20url,%20share_count,%20like_count,%20comment_count,%20total_count,%20click_count%20FROM%20link_stat%20where%20url=%27http://www.google.com%27

If you'd like to use the old (deprecated, but still working) api.facebook.com endpoint, try

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

This doesn't employ FQL at all, but you can't be sure how long this works. It's not even in their docs anymore. FQL will be around 2 years from the moment Facebook announces the successor of the Graph API v2.0, so I would recommend go go along with the first suggestion.

Graph API v2.0 doesn't have an endpoint IMHO to generate URL sharing stats other than the FQL method.