Method: spaces.messages.patch
    
    
      
    
    
      
      使用集合让一切井井有条
    
    
      
      根据您的偏好保存内容并对其进行分类。
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
    
    
    
    
      
      
        更新消息。patch 方法和 update 方法之间存在差异。patch 方法使用 patch 请求,而 update 方法使用 put 请求。我们建议使用 patch 方法。如需查看示例,请参阅更新消息。
支持以下类型的身份验证:
        
          - 使用授权范围进行应用身份验证: - 
            - https://www.googleapis.com/auth/chat.bot
 
- 使用以下授权范围之一进行用户身份验证: - 
            - https://www.googleapis.com/auth/chat.messages
- https://www.googleapis.com/auth/chat.import(仅限“导入模式聊天室”)
 
使用应用身份验证时,请求只能更新调用 Chat 应用创建的消息。
      
      
        
          HTTP 请求
          PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}
网址采用 gRPC 转码语法。
        
        
          路径参数
          
            
              
              
            
            
              
                | 参数 | 
            
            
              
                | message.name | string
 标识符。消息的资源名称。 格式:spaces/{space}/messages/{message} 其中,{space}是发布消息的聊天室的 ID,{message}是系统为消息分配的 ID。例如spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB。 如果您在创建消息时设置了自定义 ID,则可以使用此 ID 在请求中指定消息,方法是将 {message}替换为clientAssignedMessageId字段中的值。例如spaces/AAAAAAAAAAA/messages/client-custom-name。如需了解详情,请参阅为消息命名。 | 
            
          
        
        
          查询参数
          
            
              
              
            
            
              
                | 参数 | 
            
            
              
                | updateMask | string (FieldMaskformat)
 必需。要更新的字段路径。使用英文逗号分隔多个值,或使用 *更新所有字段路径。 目前支持的字段路径: | 
              
                | allowMissing | boolean
 可选。如果找不到 true和相应消息,系统会创建新消息并忽略updateMask。指定的 message ID 必须是由客户端分配的,否则请求会失败。 | 
            
          
        
        
          请求正文
          请求正文包含一个 Message 实例。
        
        
          响应正文
          如果成功,则响应正文包含一个 Message 实例。
        
        
          授权范围
          需要以下 OAuth 范围之一:
          
            - https://www.googleapis.com/auth/chat.bot
- https://www.googleapis.com/auth/chat.import
- https://www.googleapis.com/auth/chat.messages
如需了解详情,请参阅授权指南。
        
      
      
    
  
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
  最后更新时间 (UTC):2025-08-20。
  
  
  
    
      [null,null,["最后更新时间 (UTC):2025-08-20。"],[],["This documentation outlines how to update a message using the `PATCH` method via an HTTP request to `https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`.  The `message.name` path parameter is required, specifying the message's resource name.  The `updateMask` query parameter is mandatory, indicating which fields to update (e.g., text, attachments). Optionally, `allowMissing` creates a new message if one isn't found. The request and response bodies utilize the `Message` resource, and app or user authentication are supported, with specific authentication impacting permissions.\n"]]