圖形 API 版本

/{object-id}/sharedposts

此參考資料說明常見於多個圖形 API 節點的 /sharedposts 關係連線,每個節點的結構和操作皆相同。下列物件具有 sharedposts 關係連線:

  • 粉絲專頁貼文
  • 貼文
  • 用戶

瀏覽

權限

  • 具備 user_posts 權限的用戶存取權杖可供用戶在完成隱私設定後查看貼文,而這也是納入考量的其中一環。如果建立貼文的應用程式或貼文的作者授予應用程式 user_posts 權限,系統就會傳回貼文。

功能權限

名稱說明

粉絲專頁公開內容存取權限

此為必要的功能權限

限制

  • /{album-id}/sharedposts 目前無法使用。
  • GET /{photo-id}/sharedposts 端點已在 8.0 以上版本中停用。

範例

圖形 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
}];

欄位

貼文物件清單代表每次分享的內容。

發佈

您無法使用圖形 API 發佈物件分享內容。

刪除

您無法使用圖形 API 刪除物件分享內容。