我正在尝试制作Google日历推送通知API调用(
https://developers.google.com/google-apps/calendar/v3/push).我想出了如何进行日历列表调用.所以,我相信我的Oauth 2.0认证工作正在发挥作用.我猜我需要指定推送通知调用是POST.这是我的代码:
var params = { calendarId: calendarId,
id: 'my-unique-id-00001',
type: "web_hook",
address: "https://mydomain.com/notifications" };
client
.calendar.events.watch(params)
.withAuthClient(authClient)
.execute(callback);
我一直收到此错误消息:
{错误:
[{domain:’global’,
理由:’必需’,
消息:’entity.resource’,
debugInfo:’com.google.api.server.core.Fault:ImmutableErrorDefinition {base = REQUIRED,category = USER_ERROR,cause = com.google.api.server.core.Fault:Builder {base = REQUIRED,…
最佳答案 当我尝试使用Google Drive API观看某些内容时,我遇到了同样的问题.事实证明,一些参数需要在响应体中.
在您的情况下,我认为calendarId需要是路径参数,其他需要在请求体中.这样的事情应该有效
var pathParams = { calendarId: calendarId };
var bodyParams = {
id: 'my-unique-id-00001',
type: 'web_hook',
address: 'https://mydomain.com/notfications'
};
client
.calendar.events.watch(pathParams, bodyParams)
.withAuthClient(authClient)
.execute(callback);