You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Gmail API的GET请求中传入多个metadataHeaders参数

Gmail API多metadataHeaders参数的HTTP请求构造方法

你只需要通过以下两种方式之一构造请求URL即可:

方式1:重复指定metadataHeaders参数

在URL中多次添加metadataHeaders参数,每个参数对应一个需要获取的邮件头字段:

https://gmail.googleapis.com/gmail/v1/users/me/messages/${messageId}?format=metadata&metadataHeaders=To&metadataHeaders=From&metadataHeaders=Subject

注:原示例URL中的$format是笔误,正确的参数名称为format

方式2:用英文逗号分隔多个字段名

将To、From、Subject用英文逗号连接,作为单个metadataHeaders参数的值:

https://gmail.googleapis.com/gmail/v1/users/me/messages/${messageId}?format=metadata&metadataHeaders=To,From,Subject

两种方式都能让Gmail API返回包含指定三个邮件头的元数据。

内容的提问来源于stack exchange,提问作者reece

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 20:25:58