Javascript 谷歌日历API:Event:watch-频道id必须匹配[A-Za-z0-9\\\-\\\\\+;/=]+;

Javascript 谷歌日历API:Event:watch-频道id必须匹配[A-Za-z0-9\\\-\\\\\+;/=]+;,javascript,google-api-js-client,Javascript,Google Api Js Client,我已经完成了这个示例,并使其正常工作: 我现在想观察事件的变化: 在用户单击按钮后,我调用以下代码: gapi.client.calendar.events.watch({ calendarId: 'primary', resource: { id: '1234', type: 'web_hook', address: window.location.href, }, }) 然后我得到以下错误: {

我已经完成了这个示例,并使其正常工作:

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

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

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
。我真的不明白这是什么或应该是什么。文档非常稀疏:/

任何帮助都将不胜感激

提前谢谢

根据你发布的信息,应该是这样的

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

是的。应该已经正确地阅读了文档。我想我是从别的地方抄来的