Method: users.get
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
HTTP 请求
GET https://admin.googleapis.com/admin/directory/v1/users/{userKey}
网址采用 gRPC 转码语法。
路径参数
参数 |
userKey |
string
用于在 API 请求中标识用户。该值可以是用户的主电子邮件地址、别名电子邮件地址或唯一用户 ID。
|
查询参数
参数 |
customFieldMask |
string
以英文逗号分隔的架构名称列表。系统会提取这些架构中的所有字段。只有在 projection=custom 时才应设置此标志。
|
projection |
enum (Projection )
要为此用户提取的字段子集。
|
viewType |
enum (ViewType )
是提取用户的仅限管理员视图还是网域级公开视图。如需了解详情,请参阅以非管理员身份检索用户。
|
响应正文
如果成功,则响应正文包含一个 User
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.readonly
如需了解详情,请参阅授权指南。
投影
枚举 |
BASIC |
请勿为用户添加任何自定义字段。 |
CUSTOM |
添加 customFieldMask 中请求的架构中的自定义字段。 |
FULL |
包含与此用户关联的所有字段。 |
ViewType
枚举 |
admin_view |
结果包括用户的仅限管理员字段和网域公开字段。 |
domain_public |
结果仅包含对网域中的其他用户公开显示的用户字段。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["Retrieves a user.\n\nHTTP request\n\n`GET https://admin.googleapis.com/admin/directory/v1/users/{userKey}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\nPath parameters\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| `userKey` | `string` Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. |\n\nQuery parameters\n\n| Parameters ||\n|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `customFieldMask` | `string` A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when `projection=custom`. |\n| `projection` | `enum (`[Projection](/workspace/admin/directory/reference/rest/v1/users/get#Projection)`)` What subset of fields to fetch for this user. |\n| `viewType` | `enum (`[ViewType](/workspace/admin/directory/reference/rest/v1/users/get#ViewType)`)` Whether to fetch the administrator-only or domain-wide public view of the user. For more information, see [Retrieve a user as a non-administrator](https://developers.google.com/workspace/admin/directory/v1/guides/manage-users#retrieve_users_non_admin). |\n\nRequest body\n\nThe request body must be empty.\n\nResponse body\n\nIf successful, the response body contains an instance of [User](/workspace/admin/directory/reference/rest/v1/users#User).\n\nAuthorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/admin.directory.user`\n- `\n https://www.googleapis.com/auth/admin.directory.user.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nProjection\n\n| Enums ||\n|----------|--------------------------------------------------------------------|\n| `BASIC` | Do not include any custom fields for the user. |\n| `CUSTOM` | Include custom fields from schemas requested in `customFieldMask`. |\n| `FULL` | Include all fields associated with this user. |\n\nViewType\n\n| Enums ||\n|-----------------|--------------------------------------------------------------------------------------------------|\n| `admin_view` | Results include both administrator-only and domain-public fields for the user. |\n| `domain_public` | Results only include fields for the user that are publicly visible to other users in the domain. |"]]