Method: users.get
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
HTTP 要求
GET https://admin.googleapis.com/admin/directory/v1/users/{userKey}
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
userKey |
string
在 API 要求中識別使用者。這個值可以是使用者的主要電子郵件地址、別名電子郵件地址或專屬的使用者 ID。
|
查詢參數
參數 |
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
詳情請參閱授權指南。
預測值
列舉 |
BASIC |
請勿為使用者加入任何自訂欄位。 |
CUSTOM |
加入 customFieldMask 中要求的結構定義中自訂欄位。 |
FULL |
包含與此使用者相關聯的所有欄位。 |
ViewType
列舉 |
admin_view |
結果包含使用者的管理員專用欄位和網域公開欄位。 |
domain_public |
結果只會包含使用者公開顯示給網域中其他使用者的欄位。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],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. |"]]