Method: spaces.spaceEvents.get
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回 Google Chat 聊天室中的事件。事件载荷包含发生更改的资源的最新版本。例如,如果您请求有关新消息的事件,但该消息后来被更新了,服务器会在事件载荷中返回更新后的 Message
资源。
注意:对于此请求,系统不会在聊天室事件数据的聊天室对象中返回 permissionSettings
字段。
需要用户身份验证,且授权范围适合读取请求的数据:
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.messages.readonly
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.messages.reactions.readonly
https://www.googleapis.com/auth/chat.messages.reactions
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.memberships
如需获取事件,经过身份验证的用户必须是聊天室的成员。
如需查看示例,请参阅从 Google Chat 聊天室获取事件详细信息。
HTTP 请求
GET https://chat.googleapis.com/v1/{name=spaces/*/spaceEvents/*}
网址采用 gRPC 转码语法。
路径参数
参数 |
name |
string
必需。聊天室事件的资源名称。 格式:spaces/{space}/spaceEvents/{spaceEvent}
|
响应正文
如果成功,则响应正文包含一个 SpaceEvent
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.messages.readonly
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.messages.reactions
https://www.googleapis.com/auth/chat.messages.reactions.readonly
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThis request returns an event from a Google Chat space, providing the most recent version of the changed resource in the payload.\u003c/p\u003e\n"],["\u003cp\u003eTo get an event, the authenticated user must be a member of the space and use the \u003ccode\u003eGET\u003c/code\u003e method with the specified URL structure.\u003c/p\u003e\n"],["\u003cp\u003eThe request body should be empty, and a successful response returns a \u003ccode\u003eSpaceEvent\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThis action requires specific OAuth scopes related to Google Chat spaces, messages, memberships, and reactions for authorization.\u003c/p\u003e\n"]]],["This describes retrieving a Google Chat space event using a `GET` request to `https://chat.googleapis.com/v1/{name=spaces/*/spaceEvents/*}`. The `name` path parameter, in the format `spaces/{space}/spaceEvents/{spaceEvent}`, is required. The request body must be empty. Successful requests return a `SpaceEvent` instance, containing the resource's latest version. Authentication requires specific OAuth scopes, and the user must be a space member. The event payload details any resource changes within the space.\n"],null,["# Method: spaces.spaceEvents.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReturns an event from a Google Chat space. The [event payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated `Message` resource in the event payload.\n\nNote: The `permissionSettings` field is not returned in the Space object of the Space event data for this request.\n\nRequires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with an [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data:\n\n- `https://www.googleapis.com/auth/chat.spaces.readonly`\n- `https://www.googleapis.com/auth/chat.spaces`\n- `https://www.googleapis.com/auth/chat.messages.readonly`\n- `https://www.googleapis.com/auth/chat.messages`\n- `https://www.googleapis.com/auth/chat.messages.reactions.readonly`\n- `https://www.googleapis.com/auth/chat.messages.reactions`\n- `https://www.googleapis.com/auth/chat.memberships.readonly`\n- `https://www.googleapis.com/auth/chat.memberships`\n\nTo get an event, the authenticated user must be a member of the space.\n\nFor an example, see [Get details about an event from a Google Chat space](https://developers.google.com/workspace/chat/get-space-event).\n\n### HTTP request\n\n`GET https://chat.googleapis.com/v1/{name=spaces/*/spaceEvents/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The resource name of the space event. Format: `spaces/{space}/spaceEvents/{spaceEvent}` |\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 [SpaceEvent](/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.spaces`\n- `https://www.googleapis.com/auth/chat.spaces.readonly`\n- `https://www.googleapis.com/auth/chat.messages`\n- `https://www.googleapis.com/auth/chat.messages.readonly`\n- `https://www.googleapis.com/auth/chat.memberships`\n- `https://www.googleapis.com/auth/chat.memberships.readonly`\n- `https://www.googleapis.com/auth/chat.messages.reactions`\n- `https://www.googleapis.com/auth/chat.messages.reactions.readonly`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]