Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 211
Programista Avatar asked Sep 19 '14 18:09

Programista


People also ask

Is Facebook Graph api deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

What 3 terms does Facebook use to describe what the graph api is composed of?

The Graph API is named after the idea of a "social graph" — a representation of the information on Facebook. It's composed of nodes, edges, and fields.

Which endpoint is suitable to get the number of likes on an article comment?

Use the likes field of an object to get the number of likes. We recommended that you use the /object/reactions endpoint to get like counts, if available.


1 Answers

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.

like image 112
Tobi Avatar answered Sep 28 '22 16:09

Tobi