使用 google 人 api 获取群组联系人

Get contacts of a group using google people api

到目前为止,现有的问题和答案对我没有帮助。 我正在尝试让在线“试试这个 API”为我工作。 people.connections.list 和 contactGroups.get 适合我。 但是,我找不到获取给定组的联系人列表的方法。 看起来应该很简单。

试试这个:

  1. 使用 contactGroups.get 并指定 非零 maxMembers 参数。
  2. 从返回的 ContactGroup 对象中列出数组 memberResourceNames[]
{
  "resourceName": string,
  "etag": string,
  "metadata": {
    object (ContactGroupMetadata)
  },
  "groupType": enum (GroupType),
  "name": string,
  "formattedName": string,
  "memberResourceNames": [
    string
  ],
  "memberCount": integer,
  "clientData": [
    {
      object (GroupClientData)
    }
  ]
}
  1. 使用 people.getBatchGet 使用检索到的资源名称。

我先做了一个contactGroups.list。 对于您的第 1 步。我必须从列表中设置 resourceName = contactGroups/hex 值 输出看起来不像你的

{
  "resourceName": "contactGroups/443...",
  "etag": "k+...,
  "metadata": {
    "updateTime": "2020-11-08T15:29:59.193Z"
  },
  "groupType": "USER_CONTACT_GROUP",
  "name": "Tennis",
  "formattedName": "Tennis",
  "memberCount": 46
}

编辑:仅当您在 maxMembers 参数上指定 >0 时,memberResourceNames 数组才会出现。