1

我正在通过 API 获取 Facebook 新闻提要。用户可以对网站上的帖子发表评论。但有些帖子不允许评论喜欢故事,添加朋友故事,更改个人资料图片故事

我如何检查帖子是否允许评论

4

1 回答 1

3

当您从 API 检索帖子时,该帖子的actions属性将显示当前(您正在使用其 access_token)用户是否可以喜欢或评论帖子,例如

/20531316728_167191526758558

包含:

{
  "id": "20531316728_167191526758558", 
  "from": {
    "name": "Facebook", 
    "category": "Product/service", 
    "id": "20531316728"
  }, 
  "message": "Find your polling place on Facebook at http://bit.ly/Fbppl and then watch the nation vote in real time.", 
  "picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCD6BNbTzxhmwEq&w=90&h=90&url=https%3A%2F%2Fs3.amazonaws.com%2FFacebookHackers-production%2Fissue4_data%2Fissue4_fb_og.png", 
  "link": "http://www.facebookstories.com/vote", 
  "name": "America Votes 2012", 
  "caption": "www.facebookstories.com", 
  "description": "Watch the nation vote in real time.", 
  "icon": "https://s-static.ak.facebook.com/rsrc.php/v2/yN/x/aS8ecmYRys0.gif", 
  "actions": [
    {
      "name": "Comment", 
      "link": "https://www.facebook.com/20531316728/posts/167191526758558"
    }, 
    {
      "name": "Like", 
      "link": "https://www.facebook.com/20531316728/posts/167191526758558"
    }
  ], 
// (and more properties which aren't relevant
于 2012-11-16T06:09:34.117 回答