Search code examples
facebookfacebook-graph-apifacebook-fql

How to get facebook share, like, comment count for a url with graph api only (in a non-deprecated way)


The problem is that after v2.1 of graph api fql will be deprecated.

Can someone tell me how to get separate likes, share count for given url using only graph api? I was looking for some documentation, but there isn't any, i can get only total "shares" which is likes + shares + comments.

Yes i know there is immortal http://api.facebook.com/restserver.php?method=links.getStats&urls, but what if facebook shuts it down at last?


Solution

  • The REST API (with calls like http://api.facebook.com/restserver.php?method=links.getStats&urls) was announced as deprecated with the introduction of the Graph API v2.1: https://developers.facebook.com/docs/apps/changelog#v2_1_deprecations but also already in 2011: https://developers.facebook.com/blog/post/616/

    So, from my understanding, this will yield in the inoperability of this feature at two years after the introduction of v2.1 on 7th August 2016:

    https://developers.facebook.com/docs/apps/versions#howlong

    The closest you can get to the "old" REST of FQL API call results with the Graph API is this afaik:

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

    but it omits the like_count metric (don't ask me why...).

    My personal opinion is that you should continue to use the FQL calls to the link_stat (https://developers.facebook.com/docs/reference/fql/link_stat/) table, because this will be available for nearly the next 2 years. This is only possible if you have a v2.0 app. Maybe there'll be some additional endpoints for the Graph API until then.