Method: spaces.members.delete
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
删除会员资格。如需查看示例,请参阅从聊天室中移除用户或 Google Chat 应用。
支持以下类型的身份验证:
应用身份验证(需经管理员批准)和授权范围:
https://www.googleapis.com/auth/chat.app.memberships
使用以下授权范围之一进行用户身份验证:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app
(从聊天室中移除通话应用)
https://www.googleapis.com/auth/chat.import
(仅限“导入模式聊天室”)
- 当管理员账号通过身份验证时,用户身份验证会授予管理员权限,
useAdminAccess
为 true
,并使用以下授权范围:
https://www.googleapis.com/auth/chat.admin.memberships
应用身份验证不支持以下使用情形:
- 从聊天室中移除 Google 群组。
- 从聊天室中移除 Chat 应用。
如需删除聊天室管理员的成员身份,请求者必须是聊天室管理员。如果您使用的是应用身份验证,则 Chat 应用必须是聊天室创建者。
HTTP 请求
DELETE https://chat.googleapis.com/v1/{name=spaces/*/members/*}
网址采用 gRPC 转码语法。
路径参数
参数 |
name |
string
必需。要删除的会员资格的资源名称。聊天应用可以删除人类用户或其自身的会员资格。聊天应用无法删除其他应用的会员资格。 删除人员成员身份时,需要 chat.memberships 范围(包含用户身份验证)或 chat.memberships.app 范围(包含应用身份验证)以及 spaces/{space}/members/{member} 格式。您可以使用该电子邮件地址作为 {member} 的别名。例如,spaces/{space}/members/example@gmail.com ,其中 example@gmail.com 是 Google Chat 用户的电子邮件地址。 删除应用会员资格时,需要 chat.memberships.app 范围和 spaces/{space}/members/app 格式。 格式:spaces/{space}/members/{member} 或 spaces/{space}/members/app 。
|
查询参数
参数 |
useAdminAccess |
boolean
可选。如果值为 true ,则该方法会使用用户的 Google Workspace 管理员权限运行。 调用用户必须是拥有“管理聊天和聊天室对话”权限的 Google Workspace 管理员。 需要 chat.admin.memberships OAuth 2.0 范围。 不支持使用管理员访问权限删除聊天室中的应用成员。
|
响应正文
如果成功,则响应正文包含一个 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
https://www.googleapis.com/auth/chat.memberships.app
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-29。
[null,null,["最后更新时间 (UTC):2025-07-29。"],[[["\u003cp\u003eDeletes a specified membership from a Google Chat space, allowing removal of human users or Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eRequires specific OAuth scopes depending on the type of membership being deleted and whether admin privileges are used.\u003c/p\u003e\n"],["\u003cp\u003eSupports app and user authentication, with an option for administrator approval in Developer Preview for app authentication.\u003c/p\u003e\n"],["\u003cp\u003eUses a \u003ccode\u003eDELETE\u003c/code\u003e request with the membership's resource name specified in the path.\u003c/p\u003e\n"],["\u003cp\u003eProvides an optional \u003ccode\u003euseAdminAccess\u003c/code\u003e query parameter to utilize administrator privileges when deleting human memberships.\u003c/p\u003e\n"]]],["This API action deletes a membership using a `DELETE` request to `https://chat.googleapis.com/v1/{name=spaces/*/members/*}`. It requires specifying the membership's resource name in the `name` path parameter. Deleting human memberships requires the `chat.memberships` scope, while deleting app memberships requires the `chat.memberships.app` scope. Administrators can use `useAdminAccess` query parameter to operate with elevated privileges. The request body should be empty, and a successful response returns a `Membership` instance. Necessary authorization scopes include `chat.app.memberships`, `chat.admin.memberships`, `chat.import`, `chat.memberships`, and `chat.memberships.app`.\n"],null,["# Method: spaces.members.delete\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\nDeletes a membership. For an example, see [Remove a user or a Google Chat app from a space](https://developers.google.com/workspace/chat/delete-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`\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.memberships.app` (to remove the calling app from the space)\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\nApp authentication is not supported for the following use cases:\n\n- Removing a Google Group from a space.\n- Removing a Chat app from a space.\n\nTo delete memberships for space managers, the requester must be a space manager. If you're using [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) the Chat app must be the space creator.\n\n### HTTP request\n\n`DELETE https://chat.googleapis.com/v1/{name=spaces/*/members/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. Resource name of the membership to delete. Chat apps can delete human users' or their own memberships. Chat apps can't delete other apps' memberships. When deleting a human membership, requires the `chat.memberships` scope with [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) or the `chat.memberships.app` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and the `spaces/{space}/members/{member}` format. You can use the email as an alias for `{member}`. For example, `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the email of the Google Chat user. When deleting an app membership, requires the `chat.memberships.app` scope and `spaces/{space}/members/app` format. Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. |\n\n### Query parameters\n\n| Parameters ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\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). Deleting app memberships in a space isn't supported using admin access. |\n\n### Request body\n\nThe request body must be empty.\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- `https://www.googleapis.com/auth/chat.memberships.app`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]