Jack Dre
Jack Dre

Reputation: 1036

Google Calendar API: Domain Global, Error not found

I have checked all the the similar threads and didn't find what I was looking for. I've been struggling with this past few days.

I'm trying to make free/busy request.

Code is the same sometimes it returns calendar with no errors and some times I get the error below{ domain: "global", reason: "notFound"}

Has anyone run into a similar problem?

   googleapis.discover('calendar', 'v3').execute(function(err, client) {
            var oauth2Client = new OAuth2Client(clientID, secret, callback);
            oauth2Client.credentials = {
                access_token: mytoken,
                refresh_token: refreshtoken
            }
            client.calendar.freebusy.query({
                "timeMin": day + 'T00:00:00' + finalTimeZone,
                "timeMax": nextday + 'T00:00:00' + finalTimeZone,
                'timeZone': timezone
            }).withAuthClient(oauth2Client).execute(function(err, result) {
                if (err) {
                    console.log(err);
                } else {
                  console.log(result);
            }
            });
        });

result:

    {
        kind: "calendar#freeBusy",
        timeMin: "2013-11-05T08:00:00.000Z",
        timeMax: "2013-11-06T08:00:00.000Z",
        calendars: {
        [email protected]: {
            errors: [
            {
            domain: "global",
            reason: "notFound"
            }
            ],
        busy: [ ]
                }
         }
    }

Upvotes: 2

Views: 2558

Answers (1)

maxcnunes
maxcnunes

Reputation: 3027

I got this same error message. In my case was missing the calendar id.

  client.calendar.events.insert({
      calendarId: 'my calendar id'
    }, {
      'start': { 'dateTime': '2014-03-03T01:00:00.000Z' },
      'end':  { 'dateTime': '2014-03-03T09:00:00.000Z' }
  })
  .withAuthClient(auth)
  .execute(function(err, result){
    if (err) return callback(err);
    callback(null, result);
  });

How to discover you calendar id: http://youtu.be/m_ph_hYT_SY

Usually the calendar id is your proper email or you can use the value 'primary'.

Upvotes: 2

Related Questions