Method: spaces.members.patch
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
更新會員方案。如需範例,請參閱「更新使用者在聊天室中的成員資格」。
支援下列類型的驗證:
應用程式驗證 (須經管理員核准),授權範圍如下:
https://www.googleapis.com/auth/chat.app.memberships
(僅限應用程式建立的聊天室)
使用者驗證,並使用下列其中一個授權範圍:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.import
(僅限匯入模式聊天室)
- 使用者驗證會在管理員帳戶通過驗證時授予管理員權限,
useAdminAccess
為 true
,且使用下列授權範圍:
https://www.googleapis.com/auth/chat.admin.memberships
HTTP 要求
PATCH https://chat.googleapis.com/v1/{membership.name=spaces/*/members/*}
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
membership.name |
string
ID。伺服器指派的會員資源名稱。 格式:spaces/{space}/members/{member}
|
查詢參數
參數 |
updateMask |
string (FieldMask format)
必要欄位。要更新的欄位路徑。以半形逗號分隔多個值,或使用 * 更新所有欄位路徑。 目前支援的欄位路徑:
|
useAdminAccess |
boolean
(選用步驟) 時,這個方法會使用使用者的 Google Workspace 管理員權限執行。true 通話使用者必須是具備「管理即時通訊和聊天室對話」權限的 Google Workspace 管理員。 需要 chat.admin.memberships OAuth 2.0 範圍。
|
要求主體
要求主體包含 Membership
的例項。
回應主體
如果成功,回應主體會包含 Membership
的執行例項。
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/chat.app.memberships
https://www.googleapis.com/auth/chat.admin.memberships
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.memberships
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-29 (世界標準時間)。
[null,null,["上次更新時間:2025-07-29 (世界標準時間)。"],[[["\u003cp\u003eThis method updates a Google Chat membership, allowing you to modify aspects like user roles within a space.\u003c/p\u003e\n"],["\u003cp\u003eIt supports both app and user authentication, with an option for administrator privileges using \u003ccode\u003euseAdminAccess\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying fields to update with \u003ccode\u003eupdateMask\u003c/code\u003e and includes optional use of administrator privileges.\u003c/p\u003e\n"],["\u003cp\u003eYou need appropriate OAuth scopes such as \u003ccode\u003echat.app.memberships\u003c/code\u003e or \u003ccode\u003echat.admin.memberships\u003c/code\u003e for authorization.\u003c/p\u003e\n"]]],["This documentation details updating a membership via a `PATCH` HTTP request to `https://chat.googleapis.com/v1/{membership.name=spaces/*/members/*}`. Key actions include setting the `membership.name` path parameter and using the `updateMask` query parameter to specify fields for updating, such as `role`. Optionally, `useAdminAccess` can grant administrator privileges. The request body defines the new membership details, and the response body will contain updated membership information. Multiple authorization scopes are required.\n"],null,["# Method: spaces.members.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates a membership. For an example, see [Update a user's membership in a space](https://developers.google.com/workspace/chat/update-members).\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.app.memberships` (only in spaces the app created)\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.memberships`\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n - User authentication grants administrator privileges when an administrator account authenticates, `useAdminAccess` is `true`, and the following authorization scope is used:\n - `https://www.googleapis.com/auth/chat.admin.memberships`\n\n### HTTP request\n\n`PATCH https://chat.googleapis.com/v1/{membership.name=spaces/*/members/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------|\n| `membership.name` | `string` Identifier. Resource name of the membership, assigned by the server. Format: `spaces/{space}/members/{member}` |\n\n### Query parameters\n\n| Parameters ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` Required. The field paths to update. Separate multiple values with commas or use `*` to update all field paths. Currently supported field paths: - `role` |\n| `useAdminAccess` | `boolean` Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.memberships` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). |\n\n### Request body\n\nThe request body contains an instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Response body\n\nIf successful, the response body contains an instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.app.memberships`\n- `https://www.googleapis.com/auth/chat.admin.memberships`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.memberships`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]