Method: users.watch
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
HTTP 请求
POST https://admin.googleapis.com/admin/directory/v1/users/watch
网址采用 gRPC 转码语法。
查询参数
参数 |
domain |
string
域名。填写此字段可仅获取此网域中的用户。改为返回多网域填充客户字段中的所有用户。”
|
customer |
string
Google Workspace 账号的不可变 ID。如果是多网域,如需提取客户的所有用户,请填写此字段,而不是“网域”。
|
event |
enum (EventType )
要监控的事件。
|
customFieldMask |
string
以英文逗号分隔的架构名称列表。系统会提取这些架构中的所有字段。仅当 projection=custom 时,才应设置此值。
|
maxResults |
integer
返回的结果数上限。
|
orderBy |
enum (OrderBy )
用于对结果进行排序的列
|
pageToken |
string
用于指定列表中下一页的令牌
|
projection |
enum (Projection )
要为此用户提取的字段子集。
|
query |
string
查询字符串搜索。应采用“”格式。如需查看完整文档,请访问 https: //developers.google.com/workspace/admin/directory/v1/guides/search-users
|
showDeleted |
string
如果设为 true,则会检索已删除用户的列表。(默认值:false)
|
sortOrder |
enum (SortOrder )
是按升序还是降序返回结果。
|
viewType |
enum (ViewType )
是提取用户的仅限管理员视图还是网域级公开视图。如需了解详情,请参阅以非管理员身份检索用户。
|
响应正文
如果成功,则响应正文包含一个 SubscriptionChannel
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/cloud-platform
如需了解详情,请参阅授权指南。
EventType
枚举 |
ADD |
用户创建的事件 |
DELETE |
“用户被删除”事件 |
MAKE_ADMIN |
用户管理员状态更改事件 |
UNDELETE |
用户取消删除事件 |
UPDATE |
“用户更新”事件 |
OrderBy
枚举 |
EMAIL |
用户的主电子邮件地址。 |
FAMILY_NAME |
用户的姓氏。 |
GIVEN_NAME |
用户的名字。 |
投影
枚举 |
BASIC |
请勿为用户添加任何自定义字段。 |
CUSTOM |
包含 customFieldMask 中提及的架构中的自定义字段。 |
FULL |
包含与此用户关联的所有字段。 |
SortOrder
枚举 |
ASCENDING |
升序。 |
DESCENDING |
降序。 |
ViewType
枚举 |
admin_view |
结果包括仅限管理员的字段和网域公开字段。 |
domain_public |
结果仅包含对网域中的其他用户公开显示的用户字段。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["# Method: users.watch\n\nWatches for changes in users list.\n\n### HTTP request\n\n`POST https://admin.googleapis.com/admin/directory/v1/users/watch`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domain` | `string` Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead.\" |\n| `customer` | `string` Immutable ID of the Google Workspace account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain. |\n| `event` | `enum (`[EventType](/workspace/admin/directory/reference/rest/v1/users/watch#EventType)`)` Events to watch for. |\n| `customFieldMask` | `string` Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom. |\n| `maxResults` | `integer` Maximum number of results to return. |\n| `orderBy` | `enum (`[OrderBy](/workspace/admin/directory/reference/rest/v1/users/watch#OrderBy)`)` Column to use for sorting results |\n| `pageToken` | `string` Token to specify next page in the list |\n| `projection` | `enum (`[Projection](/workspace/admin/directory/reference/rest/v1/users/watch#Projection)`)` What subset of fields to fetch for this user. |\n| `query` | `string` Query string search. Should be of the form \"\". Complete documentation is at https: //developers.google.com/workspace/admin/directory/v1/guides/search-users |\n| `showDeleted` | `string` If set to true, retrieves the list of deleted users. (Default: false) |\n| `sortOrder` | `enum (`[SortOrder](/workspace/admin/directory/reference/rest/v1/users/watch#SortOrder)`)` Whether to return results in ascending or descending order. |\n| `viewType` | `enum (`[ViewType](/workspace/admin/directory/reference/rest/v1/users/watch#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\n### Request body\n\nThe request body contains an instance of [SubscriptionChannel](/workspace/admin/directory/reference/rest/v1/SubscriptionChannel).\n\n### Response body\n\nIf successful, the response body contains an instance of [SubscriptionChannel](/workspace/admin/directory/reference/rest/v1/SubscriptionChannel).\n\n### Authorization 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- `\n https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nEventType\n---------\n\nType of the Subscription event\n\n| Enums ||\n|--------------|--------------------------------|\n| `ADD` | User Created Event |\n| `DELETE` | User Deleted Event |\n| `MAKE_ADMIN` | User Admin Status Change Event |\n| `UNDELETE` | User Undeleted Event |\n| `UPDATE` | User Updated Event |\n\nOrderBy\n-------\n\n| Enums ||\n|---------------|----------------------------|\n| `EMAIL` | Primary email of the user. |\n| `FAMILY_NAME` | User's family name. |\n| `GIVEN_NAME` | User's given name. |\n\nProjection\n----------\n\n| Enums ||\n|----------|------------------------------------------------------------------|\n| `BASIC` | Do not include any custom fields for the user. |\n| `CUSTOM` | Include custom fields from schemas mentioned in customFieldMask. |\n| `FULL` | Include all fields associated with this user. |\n\nSortOrder\n---------\n\n| Enums ||\n|--------------|-------------------|\n| `ASCENDING` | Ascending order. |\n| `DESCENDING` | Descending order. |\n\nViewType\n--------\n\n| Enums ||\n|-----------------|--------------------------------------------------------------------------------------------------|\n| `admin_view` | Results include both administrator-only and domain-public fields. |\n| `domain_public` | Results only include fields for the user that are publicly visible to other users in the domain. |"]]