Method: users.watch
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คอยดูการเปลี่ยนแปลงในรายชื่อผู้ใช้
คำขอ HTTP
POST https://admin.googleapis.com/admin/directory/v1/users/watch
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์การค้นหา
พารามิเตอร์ |
domain |
string
ชื่อโดเมน กรอกข้อมูลในช่องนี้เพื่อรับผู้ใช้จากโดเมนนี้เท่านั้น หากต้องการแสดงผู้ใช้ทั้งหมดในโดเมนหลายรายการ ให้กรอกช่องลูกค้าแทน"
|
customer |
string
รหัสแบบคงที่ของบัญชี Google Workspace ในกรณีที่มีหลายโดเมน หากต้องการดึงข้อมูลผู้ใช้ทั้งหมดสำหรับลูกค้า ให้กรอกข้อมูลในช่องนี้แทนโดเมน
|
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
หากตั้งค่าเป็น "จริง" ระบบจะดึงข้อมูลรายชื่อผู้ใช้ที่ถูกลบ (ค่าเริ่มต้น: เท็จ)
|
sortOrder |
enum (SortOrder )
แสดงผลลัพธ์ตามลําดับจากน้อยไปมากหรือมากไปน้อย
|
viewType |
enum (ViewType )
เลือกว่าจะดึงข้อมูลมุมมองสาธารณะของผู้ดูแลระบบเท่านั้นหรือมุมมองสาธารณะทั่วทั้งโดเมน โปรดดูข้อมูลเพิ่มเติมที่หัวข้อดึงข้อมูลผู้ใช้ในฐานะผู้ใช้ที่ไม่ใช่ผู้ดูแลระบบ
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ SubscriptionChannel
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ 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
ประเภทเหตุการณ์การสมัครใช้บริการ
Enum |
ADD |
เหตุการณ์ที่ผู้ใช้สร้างขึ้น |
DELETE |
กิจกรรมที่ผู้ใช้ลบ |
MAKE_ADMIN |
เหตุการณ์การเปลี่ยนแปลงสถานะผู้ดูแลระบบของผู้ใช้ |
UNDELETE |
เหตุการณ์ที่ยกเลิกการลบผู้ใช้ |
UPDATE |
เหตุการณ์ที่อัปเดตโดยผู้ใช้ |
OrderBy
Enum |
EMAIL |
อีเมลหลักของผู้ใช้ |
FAMILY_NAME |
นามสกุลของผู้ใช้ |
GIVEN_NAME |
ชื่อจริงของผู้ใช้ |
การฉายภาพ
Enum |
BASIC |
อย่าใส่ช่องที่กำหนดเองสำหรับผู้ใช้ |
CUSTOM |
รวมช่องที่กำหนดเองจากสคีมาที่กล่าวถึงใน customFieldMask |
FULL |
ใส่ช่องทั้งหมดที่เชื่อมโยงกับผู้ใช้รายนี้ |
SortOrder
Enum |
ASCENDING |
เรียงลำดับจากน้อยไปมาก |
DESCENDING |
เรียงลำดับจากมากไปน้อย |
ViewType
Enum |
admin_view |
ผลลัพธ์จะรวมทั้งช่องสำหรับผู้ดูแลระบบเท่านั้นและช่องโดเมนสาธารณะ |
domain_public |
ผลลัพธ์จะมีเฉพาะช่องสำหรับผู้ใช้ที่ผู้ใช้รายอื่นในโดเมนมองเห็นแบบสาธารณะ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],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. |"]]