图谱 API 版

里程碑 /{milestone-id}

表示 Facebook 公共主页上的一个里程碑。

相关指南

读取

图谱 API 探索工具
GET /v19.0/{milestone-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(
    '/{milestone-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(
    "/{milestone-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{milestone-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:@"/{milestone-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

权限

如要查看任何公共主页上公开分享的里程碑,您将需要:

如要查看您管理的公共主页里程碑,您将需要:

字段

名称 描述 类型

id

里程碑事件的编号

string

title

里程碑的标题

string

from

发布里程碑的公共主页。

Page

description

有关里程碑的描述

string

created_time

里程碑的创建时间

datetime

updated_time

里程碑的更新时间

datetime

start_time

里程碑的开始时间

datetime

end_time

里程碑的结束时间。公共主页里程碑都具有相同的开始和结束时间

datetime

创建

您无法在此端点上执行此操作。

可使用 /{page-id}/milestones 端点为公共主页新建里程碑。

删除

权限

如要删除您管理的公共主页的里程碑,您将需要:

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

字段

无需删除任何字段。

响应

如果成功,则返回:

{
  "success": true
}

否则系统会返回相关的错误消息。

更新

权限

您无法在此端点上执行此操作。

连线

名称 描述

/likes

点赞名单。

/comments

评论名单。