Graph API 版本

/{object-id}/sharedposts

本參考文件將講述多個 Graph API 節點常用的 /sharedposts 關係連線。所有節點的架構和操作均為相同。下列物件均有 sharedposts 關係連線:

  • PagePost
  • Post
  • User

讀取

權限

  • 擁有 user_posts 權限的用戶存取憑證,適用於經私隱設定篩選後仍能夠查看帖子的用戶。如果 (a) 相關帖子是由應用程式建立,或者 (b) 帖子創作者已向應用程式授予 user_posts 權限,系統便會傳回帖子。

功能權限

名稱說明

專頁公開內容存取權限

此為必要的功能權限

限制

  • /{album-id}/sharedposts 並不適用。
  • GET /{photo-id}/sharedposts 端點已在 v8.0 版及更新版本停用。

範例

Graph API 測試工具
GET /v19.0/{object-id}/sharedposts 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(
    '/{object-id}/sharedposts',
    '{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(
    "/{object-id}/sharedposts",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{object-id}/sharedposts",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{object-id}/sharedposts"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

欄位

代表各項分享內容的帖子物件清單。

發佈

您無法發佈使用 Graph API 的物件分享內容。

刪除

您無法刪除使用 Graph API 的物件分享內容。