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 |
使用者更新事件 |
排序依據
列舉 |
EMAIL |
使用者的主要電子郵件地址。 |
FAMILY_NAME |
使用者的姓氏。 |
GIVEN_NAME |
使用者的名字。 |
預測值
列舉 |
BASIC |
請勿為使用者加入任何自訂欄位。 |
CUSTOM |
加入 customFieldMask 中所提及的結構定義中所含的自訂欄位。 |
FULL |
包含與此使用者相關聯的所有欄位。 |
SortOrder
列舉 |
ASCENDING |
遞增順序。 |
DESCENDING |
遞減順序。 |
ViewType
列舉 |
admin_view |
結果包含僅限管理員和網域公開欄位。 |
domain_public |
結果只會包含使用者公開顯示給網域中其他使用者的欄位。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]