Facebook

Facebook is the largest social network.

An app_id and app_secret are required for OAuth authentication and can be obtained from the Facebook App Dashboard. Lagotto uses the following URL to get the access_token:

https://graph.facebook.com/oauth/access_token?client_id=%{client_id}&client_secret=%{client_secret}&grant_type=client_credentials

Since January 2013 Facebook aggregates the stats from DOIs (e.g. http://dx.doi.org/10.1371/journal.pone.0035869) with those from the journal landing page (e.g. http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0035869), so that multiple API calls per article are no longer necessary.

Facebook has problems with DOIs that require cookies during DOI resolution, and it then reports numbers for the journal site instead of the individual article. Check your article DOI in the Facebook Debugger if you aren't sure that Facebook can reach your article pages correctly.

Since the release of the v2.1 API in August 2014 the link_stat API endpoint is depreciated. New user accounts have to use the v2.1 API and only get the total count of Facebook activity, whereas users will older API keys can still use the link_stat API and get the number of shares, comments and likes in addition to the total count. Please add the following link_stat URL to the Facebook configuration to use the link_stat API:

https://graph.facebook.com/fql?access_token=%{access_token}&q=select url, share_count, like_count, comment_count, click_count, total_count from link_stat where url = '%{query_url}'

Required configuration fields

  • client_id (app_id): can be obtained by registering your application in the Facebook App Dashboard.
  • client_secret (app_secret): see above
ALM Name facebook
ALM Configuration staleness: [ 1.day, 1.day, 1.month * 0.25, 1.month]
ALM Core Attributes  
ALM Other Attributes  
Protocol REST
Format JSON
Rate-limiting varies
Authentication OAuth 2.0
Restriction by IP Address no
API URL https://graph.facebook.com/v2.1/?access_token=%{access_token}&id=DOI_AS_URL
License unknown

Example Response

{
   "og_object": {
      "id": "119940294870426",
      "description": "PLOS Medicine is an open-access, peer-reviewed medical journal that publishes outstanding human studies that substantially enhance the understanding of human health and disease.",
      "title": "Why Most Published Research Findings Are False",
      "type": "article",
      "updated_time": "2014-10-24T15:34:04+0000",
      "url": "http://www.plosmedicine.org/article/info\u00253Adoi\u00252F10.1371\u00252Fjournal.pmed.0020124"
   },
   "share": {
      "comment_count": 0,
      "share_count": 9972
   },
   "id": "http://www.plosmedicine.org/article/info:doi/10.1371/journal.pmed.0020124"
}

Source Code

The source code is available here.

Further Documentation