How to make POST API calls using google-api-nodejs-client?

I am trying to make Google push push APIs API ( https://developers.google.com/google-apps/calendar/v3/push ). I figured out how to make a calendar list call. So, I'm sure my Oauth 2.0 authentication instance is working. I assume that I need to indicate that the push notification call is 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, ...

+4
1

- API Google , . , .

, 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);
+2

All Articles