使用Facebook Graph API 2.2来获取和分享计数

时间:2015-02-17 14:02:02

标签: facebook facebook-graph-api

我正在努力将项目从旧的FQL更新为图表api 2.2,我不知道如何让喜欢依赖特定的链接,他们的文档对我来说不是很透明(我是初学者)。我相信它应该是这样的:https://graph.facebook.com/v2.2/?id={myURL}/{some fields like like_count}但我不知道如何使用图形API正确地做到这一点。我将不胜感激。

1 个答案:

答案 0 :(得分:1)

嗯,我认为文档很清楚:

/?id={url}端点上没有像计数一样!样本调用将是

GET /?id=http://mashable.com/2015/02/17/10-minute-rule/

响应:

{
  "og_object": {
    "id": "664547577004455", 
    "description": "Three tips for making the 10-minute rule work for you.", 
    "title": "A 10-minute timer could revolutionize your productivity", 
    "type": "article", 
    "updated_time": "2015-02-17T13:55:11+0000", 
    "url": "http://mashable.com/2015/02/17/10-minute-rule/"
  }, 
  "share": {
    "comment_count": 0, 
    "share_count": 180
  }, 
  "id": "http://mashable.com/2015/02/17/10-minute-rule/"
}

如果您只想要分享,请使用

GET /?fields=id,share&id=http://mashable.com/2015/02/17/10-minute-rule/

响应:

{
  "id": "http://mashable.com/2015/02/17/10-minute-rule/", 
  "share": {
    "comment_count": 0, 
    "share_count": 180
  }
}