Method: users.get
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Yêu cầu HTTP
GET https://admin.googleapis.com/admin/directory/v1/users/{userKey}
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
userKey |
string
Xác định người dùng trong yêu cầu API. Giá trị này có thể là địa chỉ email chính, địa chỉ email đại diện hoặc mã nhận dạng người dùng duy nhất của người dùng.
|
Tham số truy vấn
Thông số |
customFieldMask |
string
Danh sách tên giản đồ được phân tách bằng dấu phẩy. Tất cả các trường trong các giản đồ này đều được tìm nạp. Bạn chỉ nên đặt giá trị này khi projection=custom .
|
projection |
enum (Projection )
Nhóm nhỏ các trường cần tìm nạp cho người dùng này.
|
viewType |
enum (ViewType )
Liệu có tìm nạp chế độ xem công khai trên toàn miền dành cho quản trị viên hoặc chế độ xem công khai trên toàn miền dành cho người dùng hay không. Để biết thêm thông tin, hãy xem bài viết Truy xuất người dùng khi không phải là quản trị viên.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một phiên bản của User
.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.readonly
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
Dự đoán
Enum |
BASIC |
Không thêm trường tuỳ chỉnh nào cho người dùng. |
CUSTOM |
Bao gồm các trường tuỳ chỉnh từ các giản đồ được yêu cầu trong customFieldMask . |
FULL |
Bao gồm tất cả các trường liên kết với người dùng này. |
ViewType
Enum |
admin_view |
Kết quả bao gồm cả các trường chỉ dành cho quản trị viên và các trường công khai trong miền cho người dùng. |
domain_public |
Kết quả chỉ bao gồm các trường cho người dùng mà người dùng khác trong miền có thể xem công khai. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]