Method: users.update
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
อัปเดตผู้ใช้
วิธีนี้รองรับความหมายของแพตช์ ซึ่งหมายความว่าคุณจะต้องใส่เฉพาะช่องที่ต้องการอัปเดตเท่านั้น ระบบจะเก็บรักษาฟิลด์ที่ไม่มีอยู่ในคำขอ และล้างฟิลด์ที่ตั้งค่าเป็น null
สำหรับฟิลด์ที่ซ้ำซึ่งมีอาร์เรย์ คุณจะแก้ไขรายการต่างๆ ในอาร์เรย์ทีละรายการไม่ได้ แต่จะระบุรายการเหล่านั้นในเนื้อหาคำขอพร้อมค่าที่ต้องการสำหรับรายการทั้งหมด ดูข้อมูลเพิ่มเติมได้ที่คู่มือบัญชีผู้ใช้
คำขอ HTTP
PUT https://admin.googleapis.com/admin/directory/v1/users/{userKey}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
userKey |
string
ระบุผู้ใช้ในคําขอ API ค่าอาจเป็นอีเมลหลัก อีเมลแทน หรือรหัสผู้ใช้ที่ไม่ซ้ำของผู้ใช้
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ User
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ User
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/admin.directory.user
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Method: users.update\n\nUpdates a user.\n\nThis method supports patch semantics, meaning that you only need to include the fields you wish to update. Fields that are not present in the request will be preserved, and fields set to `null` will be cleared.\n\nFor repeating fields that contain arrays, individual items in the array can't be patched piecemeal; they must be supplied in the request body with the desired values for all items. See the [user accounts guide](https://developers.google.com/workspace/admin/directory/v1/guides/manage-users#update_user) for more information.\n\n### HTTP request\n\n`PUT https://admin.googleapis.com/admin/directory/v1/users/{userKey}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path 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\n### Request body\n\nThe request body contains an instance of [User](/workspace/admin/directory/reference/rest/v1/users#User).\n\n### Response body\n\nIf successful, the response body contains an instance of [User](/workspace/admin/directory/reference/rest/v1/users#User).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/admin.directory.user`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]