Method: people.get

通过指定资源名称来提供某人的相关信息。使用 people/me 表示经过身份验证的用户。

如果未指定“personFields”,请求将返回 400 错误。

HTTP 请求

GET https://people.googleapis.com/v1/{resourceName=people/*}

网址采用 gRPC 转码语法。

路径参数

参数
resourceName

string

必需。要提供信息的人员的资源名称。

  • 如需获取有关经过身份验证的用户的信息,请指定 people/me
  • 如需获取有关 Google 帐号的信息,请指定 people/{account_id}
  • 要获取有关联系人的信息,请指定标识联系人的资源名称(由 people.connections.list 返回)。

查询参数

参数
requestMask
(deprecated)

object (RequestMask)

已弃用(请改用 personFields

用于将结果限制为一部分人字段的掩码。

personFields

string (FieldMask format)

必需。用于限制返回人员哪些字段的字段掩码。您可以指定多个字段,只需用英文逗号分隔即可。有效值包括:

  • addresses
  • ageRanges [年龄段]
  • 传记
  • 生日
  • 日历网址
  • 客户端数据
  • 封面照片
  • emailAddresses
  • events
  • externalId
  • 性别
  • IMClient
  • 兴趣
  • locales
  • 地理位置
  • memberships
  • 元数据
  • 其他关键字
  • names
  • 昵称
  • 职业
  • organizations
  • phoneNumbers
  • 照片
  • 关系
  • sipAddress
  • skills
  • 网址
  • 用户指定
sources[]

enum (ReadSourceType)

(可选)要返回的来源类型的掩码。如果未设置,则默认为 READ_SOURCE_TYPE_PROFILEREAD_SOURCE_TYPE_CONTACT

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含一个 Person 实例。

授权范围

无需授权即可访问公开数据。对于私有数据,必须提供以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/contacts
  • https://www.googleapis.com/auth/contacts.readonly
  • https://www.googleapis.com/auth/directory.readonly
  • https://www.googleapis.com/auth/profile.agerange.read
  • https://www.googleapis.com/auth/profile.emails.read
  • https://www.googleapis.com/auth/profile.language.read
  • https://www.googleapis.com/auth/user.addresses.read
  • https://www.googleapis.com/auth/user.birthday.read
  • https://www.googleapis.com/auth/user.emails.read
  • https://www.googleapis.com/auth/user.gender.read
  • https://www.googleapis.com/auth/user.organization.read
  • https://www.googleapis.com/auth/user.phonenumbers.read
  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/userinfo.profile

如需了解详情,请参阅授权指南