【问题标题】:Google calendar API: Event: watch - Channel id must match [A-Za-z0-9\\-_\\+/=]+Google 日历 API:事件:观看 - 频道 ID 必须匹配 [A-Za-z0-9\\-_\\+/=]+
【发布时间】:2019-03-31 00:05:29
【问题描述】:

我已经完成了这个例子并让它工作了:

https://developers.google.com/calendar/quickstart/js

我现在想观察事件的变化:

https://developers.google.com/calendar/v3/reference/events/watch

我在用户点击按钮后调用以下代码:

gapi.client.calendar.events.watch({
      calendarId: 'primary',
      resource: {
        id: '1234',
        type: 'web_hook',
        address: window.location.href,
      },
    })

然后我得到以下错误:

{
"error": {
 "errors": [
  {
   "domain": "push",
   "reason": "channelIdInvalid",
   "message": "Channel id must match [A-Za-z0-9\\-_\\+/=]+"
  }
 ],
 "code": 400,
 "message": "Channel id must match [A-Za-z0-9\\-_\\+/=]+"
 }
}

我相信resource.id 代表频道ID,我已将其设置为1234。我真的不明白这是什么或应该是什么。文档非常稀少:/

任何帮助将不胜感激。

提前致谢!

【问题讨论】:

    标签: javascript google-api-js-client


    【解决方案1】:

    根据您发布的docs,应该是这样的

    gapi.client.calendar.events.watch({
      id: 'primary',
      token: '1234',
      type: 'web_hook',
      address: window.location.href,
    })
    

    【讨论】:

    • 是的。应该正确阅读文档。我想我从其他地方复制了这个开始?
    猜你喜欢
    • 2012-10-22
    • 1970-01-01
    • 2015-01-07
    • 2021-11-09
    • 2019-05-31
    • 2015-02-11
    • 2010-12-11
    • 2011-11-09
    • 2012-03-26
    相关资源
    最近更新 更多