4
我正在嘗試使用NodeJS API從Google日曆獲取忙碌信息,如https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query所列。問題是我得到的唯一錯誤響應是'無效請求'。當我使用Google的Try It工具運行它時,我能夠得到迴應。我知道我正在獲得授權客戶。我能做些什麼來進一步解決這個問題?如何解決freebusy google日曆nodejs api問題?
function getAvail(auth, dateTimeRange, calID) {
var deferred = Q.defer(); // get a new deferral
calendar.freebusy.query({
auth: auth,
items: [{id: calID}],
timeMin: (dateTimeRange.start).toISOString(),
timeMax: (dateTimeRange.end).toISOString(),
}, function(err, response) {
console.log('Response from the Calendar service: ' + response);
if (err) {
console.log('There was an error contacting the Calendar service: ' + err);
deferred.reject(); // deferred reject here
return;
}
var events = response[calID]['busy'];
if (events.length == 0) {
console.log('No upcoming events found.');
} else {
console.log('busy in here...');
}
deferred.resolve(response); // deferred resolve here
});
return deferred.promise; // return a promise
}
我一直在努力通過這個自己。感謝帖子,這幫助我解決問題! – Jeffpowrs