그래프 API 버전

댓글 /{comment-id}

comment의 경우 Facebook에서 여러 가지 유형의 콘텐츠에 달 수 있습니다. 대부분의 그래프 API 노드는 해당 개체에 달린 모든 댓글을 나열하는 /comments 에지가 있습니다. /{comment-id} 노드는 단일 comment를 반환합니다.

읽기

새로운 페이지 환경

이 API는 새로운 페이지 환경에 지원됩니다.

권한

  • 일반 - 댓글을 읽으려면 일반적으로 댓글이 추가된 개체를 보는 데 필요한 것과 동일한 권한이 필요합니다.

  • 답글 - 다른 댓글에 대한 답글로 달린 댓글의 경우, 상위 댓글이 추가된 개체에 적용되는 권한이 필요합니다.

  • 페이지 소유 댓글 및 답글 - 페이지에서 소유한 댓글이나 답글의 경우, 사용자 정보를 응답에 포함하려면 페이지 액세스 토큰을 사용해야 합니다.

페이지 게시물 댓글 ID 형식인 {page-id}_{post_id}_{comment-id}는 사용 중단되었습니다. 대신 {pagepost-id}_{comment-id} 형식을 사용하세요.

그래프 API 탐색기
GET /v19.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
}];

필드

속성 이름 설명 유형

id

댓글 ID

string

attachment

댓글에 첨부된 링크, 동영상, 스티커 또는 사진

StoryAttachment

can_comment

보는 사람이 이 댓글에 답글을 남길 수 있는지 여부

bool

can_remove

보는 사람이 이 댓글을 삭제할 수 있는지 여부

bool

can_hide

보는 사람이 이 댓글을 숨길 수 있는지 여부. 페이지 관리자에게만 표시됨

boolean

can_like

보는 사람이 이 댓글에 '좋아요'를 누를 수 있는지 여부

boolean

can_reply_privately

보는 사람이 이 댓글에 비공개 답장을 보낼 수 있는지 여부(페이지 독자만 해당).

boolean

comment_count

이 댓글에 달린 답글 수

int32

created_time

이 댓글을 남긴 시간

datetime

from

이 댓글을 남긴 사람

User

like_count

이 댓글에 '좋아요'를 누른 수

int32

message

댓글 텍스트

string

message_tags

message에 태그된 프로필 배열

object[]

id

태그된 프로필 ID

string

name

태그에 사용된 텍스트

string

type

어떤 유형의 프로필이 태그되었는지 나타냄

enum{user, page, group}

offset

태그된 텍스트의 첫 문자가 message에 들어간 위치(유니코드 코드 포인트로 측정됨)

integer

length

오프셋 이후에 이 태그를 구성하는 유니코드 코드 포인트

integer

object

사진 또는 동영상이 포함된 게시물(다이내믹 게시물 포함)에 대한 댓글. 그 외 다른 경우에는 이 필드가 비어 있음

Object

parent

댓글에 달린 답글에서 답글을 달 대상인 댓글

Comment

private_reply_conversation

비공개 답글이 있는 댓글에서 페이지와 댓글 작성자 간의 대화를 가져옴(페이지 독자만 해당)

Conversation

user_likes

보는 사람이 이 댓글에 '좋아요'를 눌렀는지 여부

bool

게시

노드에 /comments 에지가 있으면 이를 사용하여 댓글을 게시할 수 있습니다.

삭제

다음의 엔드포인트를 사용하여 댓글을 삭제할 수 있습니다.

DELETE /v19.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->delete(
    '/{comment-id}',
    array (),
    '{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}",
    "DELETE",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{comment-id}",
    null,
    HttpMethod.DELETE,
    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:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

새로운 페이지 환경

이 API는 새로운 페이지 환경에 지원됩니다.

요구 사항

페이지에서 게시한 댓글을 삭제하려면 다음 항목이 필요합니다.

  • 페이지에서 'MODERATE' 작업을 수행할 수 있는 사용자가 요청한 페이지 액세스 토큰
  • pages_read_engagement 권한
  • pages_manage_engagement 권한

사용자 또는 다른 페이지에서 게시한 댓글을 삭제하려면 다음 항목이 필요합니다.

  • 페이지에서 'MODERATE' 작업을 수행할 수 있는 사용자가 요청한 페이지 액세스 토큰
  • pages_manage_engagement 권한
  • pages_read_user_content 권한

제한 사항

리뷰는 페이지 게시물이 아니므로 리뷰에 대한 댓글은 페이지에서 삭제할 수 없습니다.

응답

성공할 경우:

{
  "success": true
}

실패할 경우 관련 오류 메시지가 반환됩니다.

업데이트

다음의 엔드포인트를 사용하여 댓글을 수정할 수 있습니다.

POST /v19.0/{comment-id} HTTP/1.1
Host: graph.facebook.com

message=This+is+a+test+comment
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{comment-id}',
    array (
      'message' => 'This is a test comment',
    ),
    '{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}",
    "POST",
    {
        "message": "This is a test comment"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("message", "This is a test comment");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{comment-id}",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"message": @"This is a test comment",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{comment-id}"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

새로운 페이지 환경

이 API는 새로운 페이지 환경에 지원됩니다.

권한

  • 페이지에서 'MODERATE' 작업을 수행할 수 있는 사용자가 요청한 페이지 액세스 토큰
  • pages_read_engagement 권한
  • pages_manage_engagement 권한

댓글 숨기기

다음의 예외 사항을 제외하고 게시물에서 대부분 댓글을 숨길 수 있습니다.

  • 페이지에서 남긴 댓글
  • 페이지 관리자가 남긴 댓글
  • 페이지에서 사용자 게시물에 남긴 댓글 사용자가 소유한 게시물
  • 어떤 사용자가 다른 사용자의 게시물에서 페이지에 대해 남긴 댓글 사용자가 소유한 게시물
  • 이벤트 크리에이터가 남긴 댓글 이벤트 크리에이터가 소유한 게시물
  • Facebook 그룹이 남긴 댓글 그룹에서 소유한 게시물
  • 리뷰에 남긴 모든 댓글

필드

업데이트할 때 attachment_url, attachment_id, message 또는 attachment_share_url 중 하나를 제공해야 합니다.

메시지나 첨부 파일 중 하나를 포함해야 합니다. 첨부 파일은 url, attachment_id 또는 attachment_share_url일 수 있습니다. idurl을 함께 포함할 수 있습니다. attachment_share_url을 포함한다면 다른 필드를 포함해서는 안 됩니다.

업데이트할 때 원본 콘텐츠에 있는 모든 값을 포함해야 합니다. 그중 하나라도 포함하지 않으면 업데이트 후 콘텐츠에서 해당 필드가 삭제됩니다. 예를 들어 attachment_url을 통해 지정된 이미지가 있는 댓글을 업데이트할 때 이 필드를 포함하지 않으면 이미지가 삭제됩니다.

업데이트에서는 /object/comments의 게시 섹션에 나와 있는 필드를 지원합니다. 여기에는 attachment_url, attachment_id, message, source가 포함됩니다. 이러한 필드에 대한 자세한 내용은 해당 문서를 참조하세요.

업데이트에서는 여기에 나와 있는 is_hidden 필드도 지원합니다.

이름 설명 유형

is_hidden

이 댓글의 표시 여부. 페이지 관리자, 댓글에 태그된 그 외 모든 사용자 및 원본 게시자는 여전히 댓글을 볼 수 있음

boolean

응답

성공할 경우 다음과 같은 정보가 포함된 응답을 받게 됩니다. 또한 이 엔드포인트는 쓰기 후 읽기를 지원하고 읽기 작업으로 반환된 모든 필드를 즉시 반환할 수 있습니다.

{
  "success": true
}

실패할 경우 관련 오류 메시지가 반환됩니다.

에지

속성 이름 설명 유형
/comments

이 댓글에 답글을 단 댓글

Edge<Comment>
/likes

이 댓글에 '좋아요'를 누른 사용자

Edge<Profile>
/reactions

이 게시물에 공감한 사용자

Edge<Reaction>
/private_replies

이 댓글에 비공개 메시지 답글을 전송하는 데 사용(페이지 독자만 해당)

Edge<Message>