Graph API 版本

群組

Facebook 群組

讀取

傳回有關單一群組物件的資訊。若要獲取某個用戶管理的群組清單,請使用 /user/groups 邊緣。

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

權限

  • groups_access_member_info — 允許應用程式接收與成員有關的群組內容數據。
  • publish_to_groups — 允許應用程式代表用戶將內容發佈至群組。

若是公開和不公開群組

需要使用用戶存取憑證

若是秘密群組

需要使用群組管理員的用戶存取憑證

注意事項

  • 回應中不會包含傳回用戶資訊的欄位,除非您使用群組管理員的存取憑證提出該要求。

欄位

屬性名稱 描述 類型

id

群組編號

string

cover

有關群組封面相片的資訊。

CoverPhoto

id

代表此封面相片的相片編號。

string

source

代表此封面相片的相片網址。

string

offset_y

從底部開始的相片垂直位移(以像素為單位)。

int

offset_x

從左側開始的相片水平位移(以像素為單位)。

int

description

有關群組的簡短描述。

string

email

用於將內容上載至群組的電郵地址。只有當前的群組成員才能使用此功能。

string

icon

群組圖示的網址。

string

member_count

群組成員數量。

int

member_request_count

待處理的成員要求數量。需要使用群組管理員的存取憑證。待處理的成員要求數量必須超過 50,系統才會傳回數量。

int

name

群組名稱。

string

owner

已在 9.0 版及更高版本停用。將從 2021 年 2 月 9 日起在所有版本中停用。

User | Page

parent

群組的母體(如有)。

Group | Page

permissions

用戶向安裝在群組的應用程式所授予的權限。

string

privacy

群組的私隱設定。可能的值為 CLOSEDOPENSECRET需要使用群組管理員的存取憑證。

string

updated_time

群組的上次更新時間(包括群組屬性、帖子和回應的變更)。需要使用群組管理員的存取憑證。

datetime

建立

我們並不支援這項操作。

更新

不支援這項操作。

刪除

我們並不支援這項操作。

邊緣

名稱 描述

/admins

此邊緣已於 2018 年 4 月 4 日停用。

/albums

群組所擁有的相簿。

/docs

群組所擁有的文件。

/events

群組所擁有的事件。

/feed

群組所擁有的帖子動態。

/files

群組所擁有的檔案。

/live_videos

群組所擁有的直播視像。

/members

此邊緣已於 2018 年 4 月 4 日停用。

/photos

群組所擁有的相片。

/videos

群組所擁有的影片。