图谱 API 版

小组

Facebook 小组

读取

返回有关单个小组对象的信息。若要获取小组和用户管理员列表,应使用 /user/groups 连线。

图谱 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

在 v9.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

小组拥有的视频。