Method: users.get
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คำขอ HTTP
GET https://admin.googleapis.com/admin/directory/v1/users/{userKey}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
userKey |
string
ระบุผู้ใช้ในคําขอ API ค่าอาจเป็นอีเมลหลัก อีเมลแทน หรือรหัสผู้ใช้ที่ไม่ซ้ำของผู้ใช้
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
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
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
การฉายภาพ
Enum |
BASIC |
อย่าใส่ช่องที่กำหนดเองสำหรับผู้ใช้ |
CUSTOM |
รวมช่องที่กำหนดเองจากสคีมาที่ขอใน customFieldMask |
FULL |
ใส่ช่องทั้งหมดที่เชื่อมโยงกับผู้ใช้รายนี้ |
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,["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. |"]]