Gmail API Watch()无法正常工作 [英] Gmail API Watch() not working

查看:87
本文介绍了Gmail API Watch()无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循 https://developers.google上提供的Gmail API推送通知指南. com/gmail/api/guides/push .但是,当我尝试通过API资源管理器创建新手表时,它会给出以下响应:

I am following Gmail API Push notifications guide given at https://developers.google.com/gmail/api/guides/push. However, when I try to create a new watch from API explorer, it gives following response:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalidArgument",
    "message": "Invalid topicName does not match projects/google.com:apisexplorerconsole/topics/*"
   }
  ],
  "code": 400,
  "message": "Invalid topicName does not match projects/google.com:apisexplorerconsole/topics/*"
 }

}

我的要求似乎如下:

POST https://www.googleapis.com/gmail/v1/users/myemailaddress/watch?key={YOUR_API_KEY}
{
 "labelIds": [
  "INBOX"
 ],
 "topicName": "projects/my-project-name/topics/my-topic-name"
}

似乎是Google API端的验证检查不正确.还有其他人遇到这个问题吗?

Seems like faulty validation check at Google API end. Anyone else facing this problem?

推荐答案

您无法使用API​​资源管理器进行该调用,您需要直接进行调用(使用您的客户端,而不是API资源管理器),以便正确进行验证按照指南: https://developers.google.com/gmail/api/guides/push#gmail_watch

You can't use APIs explorer to make that call, you need to make it directly (using your client, not APIs explorer) for it to be correctly verified as per the guide: https://developers.google.com/gmail/api/guides/push#gmail_watch

如果未完成该检查,则理论上您可以使用API​​资源管理器将通知发送到任何其他随机的其他开发人员的Cloud Pub/Sub主题.

If that check were not done, you could in theory use APIs explorer to send notifications to any random other developer's Cloud Pub/Sub topic.

这篇关于Gmail API Watch()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆