圖形 API 版本

社團動態

社團擁有的貼文,包括近況更新和連結。

讀取

傳回社團中的貼文陣列。

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

需求

必備條件的類型說明

應用程式審查

應用程式必須獲准使用社團 API 功能。

應用程式安裝

社團必須安裝應用程式。

權杖

用戶存取權杖或粉絲專頁存取權杖。

備註

  • sinceuntil 參數套用於 updated_time 欄位。

發佈

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

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

需求

必備條件的類型說明

應用程式審查

您的應用程式必須獲得以下登入權限和功能的核准:(點擊展開)

登入權限

publish_to_groups

功能

社團 API

應用程式安裝

社團必須安裝應用程式。

權杖

社團成員的用戶存取權杖。

權限

用戶必須授予您的應用程式以下權限:

publish_to_groups

欄位

名稱類型說明

message

string

貼文主體,也稱為近況訊息。必須提供 linkmessage

link

string

附加至貼文的連結網址。必須提供 linkmessage。其他與 link 關聯的欄位顯示在下方。

回應

成功時,您會收到具有以下資訊的回應。此外,此端點支援寫入後讀取功能,可立即傳回讀取作業傳回的任何欄位。

名稱 說明 類型

id

新建立的貼文編號

string

更新

不支援執行此作業。

刪除

不支援執行此作業。