图谱 API 版

Comment

读取

A Facebook comment

New Page Experience

This endpoint is supported for New Page Experience.

Feature Permissions

名称描述
公共主页公开内容访问权限This feature permission may be required.

例子

Graph API Explorer
GET /v26.0/{comment-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{comment-id}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{comment-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{comment-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{comment-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南。

参数

这个端点不包含任何参数。

字段

字段描述
id
token with structure: Comment ID

The comment ID

can_comment
bool

Whether the viewer can reply to this comment

can_reply_privately
bool

Whether the page viewer can send a private reply to this comment

comment_count
unsigned int32

Number of replies to this comment

is_private
bool

Whether the comment is a private comment

like_count
unsigned int32

Number of times this comment was liked

live_broadcast_timestamp
unsigned int32

Time the comment was made on a live video

parent

For comment replies, the comment this is a reply to

private_reply_conversation

If private reply was sent to this comment, gets private conversation between the page and author of the comment that was started by private reply

user_likes
bool

Whether the viewer has liked this comment

连线

连线描述
Edge<Comment>

Comments made on this

Edge<Profile>

People who like this

Edge<Profile>

People who reacted on this

错误代码

错误描述
100Invalid parameter
80001There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
190Invalid OAuth 2.0 Access Token
283That action requires the extended permission pages_read_engagement and/or pages_read_user_content and/or pages_manage_ads and/or pages_manage_metadata
2500Error parsing graph query
459The session is invalid because the user has been checkpointed
613Calls to this api have exceeded the rate limit.
210User not visible

创建

你可以通过下列路径向 comments 连线发出 POST 请求:
发布到这个连线会创建 a Comment 。

参数

参数描述
attachment_id
numeric string or integer

ID for a photo attachment to associate with this

attachment_share_url
URL

Link to set the comment attachment to. Does not include the url in the message

attachment_url
URL

Link to set the comment attachment to

is_offline
boolean

Whether the comment was originally made while offline

message
UTF-8 string

Same as the text param

支持表情符号
text
UTF-8 string

The text of the comment that allows emoji

支持表情符号

返回类型

这个端点支持先写后读,并会读取返回类型中 id 代表的节点。
Struct {
id: token with structure: Comment ID,
}

错误代码

错误描述
100Invalid parameter
190Invalid OAuth 2.0 Access Token
368The action attempted has been deemed abusive or is otherwise disallowed
200Permissions error
1705There was an error during posting.
459The session is invalid because the user has been checkpointed

更新

你可以向 /{comment_id} 发出 POST 请求,以更新 a Comment 。

参数

参数描述
attachment_id
numeric string or integer

ID for a photo attachment to associate with this

attachment_share_url
URL

Link to set the comment attachment to. Does not include the url in the message.

attachment_url
URL

Link to set the comment attachment to.

is_hidden
boolean

Is this comment hidden? Only applicable to Page comments

message
UTF-8 string

The text in the new comment message

支持表情符号

返回类型

这个端点支持先写后读,并会读取接收你的 POST 请求的节点。
Struct {
success: bool,
}

错误代码

错误描述
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter
80001There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
190Invalid OAuth 2.0 Access Token
210User not visible

删除

你可以向 /{comment_id} 发出“删除”请求来删除 a Comment 。

参数

这个端点不包含任何参数。

返回类型

Struct {
success: bool,
}

错误代码

错误描述
200Permissions error
100Invalid parameter
368The action attempted has been deemed abusive or is otherwise disallowed
190Invalid OAuth 2.0 Access Token