Facebook shares/ Likes no longer appear on my pages

Asked

Viewed 26 times

0

Until some time ago I used this URL to recover JSON data from Facebook and display on my pages through Javascript: https://graph.facebook.com/? id=URL. However, the Ikes or shares are no longer displayed and this on all my sites. I already researched and I know that Facebook updated its Open Graph, but I could not find a simple way to solve this problem. Would anyone have any idea?

1 answer

1

Well, after a lot of research, I found the answer. Apparently, Facebook is no longer accepting GET calls without using an access token. I ended up using the same URL of the above question but adding some parameters. So, it was like this:

https://graph.facebook.com/v3.2/?id=URL_DA_PAGINA&fields=engagement&access_token=TOKEN_DE_ACESSO_DO_APLICATIVO

I used the access token of an application I had already created on Facebook Developers and I redid the total URL. JSON generated by Facebook is now something like this below:

{
   "engagement": {
      "reaction_count": 70,
      "comment_count": 52,
      "share_count": 61,
      "comment_plugin_count": 0
   },
   "id": "http://www.endereco-da-pagina-pesquisada"
}

To capture the data, then, you need a call like this within Javascript:

var MeusAcessos = parseInt(data.engagement.share_count); 

This solved my problem. In case someone reads this answer and needs more information, post your question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.