Reputation: 176
I am trying to make a Google Calendar push notification API call (https://developers.google.com/google-apps/calendar/v3/push). I figured out how to make a calendar list call. So, I am fairly confident that my Oauth 2.0 authentication piece is working. I am guessing that I need to specify that the push notification call is a POST. Here are my codes:
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);
I keep getting this error message:
{ errors: [ { domain: 'global', reason: 'required', message: '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, ...
Upvotes: 4
Views: 1241
Reputation: 168
While I was attempting to watch something using the Google Drive API, I ran into the same issue. The issue turned out to be that some of the parameters need to be in the response body.
In your case I believe that the calendarId needs to be a path parameter and the others need to be in the request body. Something like this should work
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);
Upvotes: 2