Google calendar API do not return events list
Try adding singleEvents:true
to your request.
I was having the same issue. In my case, using Javascript, this works (returns several single, non-recurring events) :
var calendar = googleapis.calendar('v3');
calendar.events.list({
auth: auth,
calendarId: 'primary',
timeMin: (new Date()).toISOString(),
maxResults: 10,
singleEvents: true,
orderBy: 'startTime'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return callback(err);
}
console.log(response);
var events = response.items;
if (events.length == 0) {
console.log('No upcoming events found.');
} else {
console.log('Upcoming 10 events:');
for (var i = 0; i < events.length; i++) {
var event = events[i];
var start = event.start.dateTime || event.start.date;
console.log('%s - %s', start, event.summary);
}
return callback(null, events);
}
});
But this does not (doesn't return any events including those that are on the 'primary' calendar and are single, non-recurring events). The only difference from above code is singleEvents
parameter is commented out so it's value will default to false
.
var calendar = googleapis.calendar('v3');
calendar.events.list({
auth: auth,
calendarId: 'primary',
timeMin: (new Date()).toISOString(),
maxResults: 10,
//singleEvents: true,
orderBy: 'startTime'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return callback(err);
}
console.log(response);
var events = response.items;
if (events.length == 0) {
console.log('No upcoming events found.');
} else {
console.log('Upcoming 10 events:');
for (var i = 0; i < events.length; i++) {
var event = events[i];
var start = event.start.dateTime || event.start.date;
console.log('%s - %s', start, event.summary);
}
return callback(null, events);
}
});
I also had the problem of events().list(calendarId=<calendar_id>, singleEvents=False)
not returning any events (using python API). I tested with a secondary calendar with one recurring event. Solved by adding parameter maxResults=9999
. It turned out that maxResults value 1413 or higher is needed to return the event. Weird, seems to be a bug.