Change Facebook API endpoint #90

Closed
mfenner opened this Issue Aug 20, 2014 · 1 comment

Projects

None yet

1 participant

@mfenner
Member
mfenner commented Aug 20, 2014

Facebook is depreciated the fql link_stat API endpoint with the 2.1 API on August 7, and new API keys no longer work. https://developers.facebook.com/docs/apps/changelog/

We should use the graph API instead.

@mfenner mfenner added this to the ALM 3.4 milestone Aug 20, 2014
@mfenner mfenner added the enhancement label Aug 20, 2014
@mfenner mfenner self-assigned this Aug 20, 2014
@mfenner
Member
mfenner commented Aug 20, 2014

Currently ALM is using this API call (with authentication): https://graph.facebook.com/fql?q=select%20url,%20share_count,%20like_count,%20comment_count,%20click_count,%20total_count%20from%20link_stat%20where%20url%20=%20%27http%3A%2F%2Fwww.plosntds.org%2Farticle%2Finfo%253Adoi%252F10.1371%252Fjournal.pntd.0001969%27

{
  "data": [
    {
      "url": "http://www.plosntds.org/article/info%3Adoi%2F10.1371%2Fjournal.pntd.0001969",
      "share_count": 2707,
      "like_count": 4603,
      "comment_count": 4447,
      "click_count": 0,
      "total_count": 11757
    }
  ]
}

The depreciated REST API call: http://api.facebook.com/restserver.php?method=links.getStats&urls=%27http%3A%2F%2Fwww.plosntds.org%2Farticle%2Finfo%253Adoi%252F10.1371%252Fjournal.pntd.0001969%27&format=json

[
  {
    "url": "http://www.plosntds.org/article/info%3Adoi%2F10.1371%2Fjournal.pntd.0001969",
    "normalized_url": "http://www.plosntds.org/article/info:doi/10.1371/journal.pntd.0001969",
    "share_count": 2707,
    "like_count": 4603,
    "comment_count": 4447,
    "total_count": 11757,
    "click_count": 0,
    "comments_fbid": 214278208697221,
    "commentsbox_count": 0
  }
]

The graph API: https://graph.facebook.com/v2.1/?id=http%3A%2F%2Fwww.plosntds.org%2Farticle%2Finfo%253Adoi%252F10.1371%252Fjournal.pntd.0001969

{
  "og_object": {
    "description": "PLOS Neglected Tropical Diseases is an open-access journal publishing peer-reviewed research on the world\\'s most neglected tropical diseases, such as elephantiasis, river blindness, leprosy, hookworm, schistosomiasis, and African sleeping sickness", 
    "title": "An In-Depth Analysis of a Piece of Shit: Distribution of Schistosoma mansoni and Hookworm Eggs in Human Stool", 
    "type": "article", 
    "updated_time": "2014-08-20T03:12:34+0000", 
    "url": "http://www.plosntds.org/article/info%3Adoi%2F10.1371%2Fjournal.pntd.0001969", 
    "id": "214278208697221"
  }, 
  "share": {
    "comment_count": 0, 
    "share_count": 11757
  }, 
  "id": "http://www.plosntds.org/article/info%3Adoi%2F10.1371%2Fjournal.pntd.0001969"
}

Using the DOI gives exactly the same reponse, as before: https://graph.facebook.com/v2.1/?id=http%3A%2F%2Fdx.doi.org%252F10.1371%252Fjournal.pntd.0001969

{
  "og_object": {
    "description": "PLOS Neglected Tropical Diseases is an open-access journal publishing peer-reviewed research on the world\\'s most neglected tropical diseases, such as elephantiasis, river blindness, leprosy, hookworm, schistosomiasis, and African sleeping sickness",
    "title": "An In-Depth Analysis of a Piece of Shit: Distribution of Schistosoma mansoni and Hookworm Eggs in Human Stool",
    "type": "article",
    "updated_time": "2014-08-20T03:12:34+0000",
    "url": "http://www.plosntds.org/article/info%3Adoi%2F10.1371%2Fjournal.pntd.0001969",
    "id": "214278208697221"
  },
  "share": {
    "comment_count": 0,
    "share_count": 11757
  },
  "id": "http://dx.doi.org/10.1371/journal.pntd.0001969"
}

The new share_countseems to be the same as the old total_count and separate numbers for likes, shares and comments don't seem to be available.

@mfenner mfenner added bug and removed enhancement labels Aug 20, 2014
@mfenner mfenner modified the milestone: Lagotto 3.7, ALM 3.4 Oct 13, 2014
@mfenner mfenner added enhancement and removed bug labels Oct 24, 2014
@mfenner mfenner closed this in 8adddc1 Oct 27, 2014
@mfenner mfenner pushed a commit that referenced this issue Oct 28, 2014
Martin Fenner Construct correct URL to get Facebook access_token. #90 93aa9de
@mfenner mfenner pushed a commit that referenced this issue Oct 29, 2014
Martin Fenner save Facebook raw JSON response #90 3fcebf3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment