Tag: 谷歌日历

Google日历API:Domain Global,未find错误

我已经检查了所有类似的线程,并没有find我正在寻找的东西。 这几天我一直在挣扎。 我正在尝试进行忙/闲请求。 代码是相同的有时它返回日历没有错误,有时我得到{域:“全球”,原因:“notFound”}下面的错误 有没有人遇到类似的问题? 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); } }); }); 结果: { […]

Google日历事件更改时更新数据库

我一直在实施谷歌日历API的一些function。 我有一个自定义日历有能力与谷歌日历同步。 这意味着,您可以创build和编辑日历和事件从我的仪表板到谷歌日历帐户。 我面临的主要问题是,如果我直接从我的谷歌日历更新事件。 我已经实现了推送通知,并得到这样的回应: { "Google_channel_ID": "19835150 – 0057 – 11e6 – bc9c – 1735798 ca540", "Google_channel_token": "calendar_id = 4e7 d5c20ht9lpfdtuukcsvgeq4 @group.calendar.google.com & user_id = 43e d7rxeqqce3fk09ahszc", "Google_channel_expiration": "Tue,12 Apr 2016 12: 34: 36 GMT", "Google_resource_id": "oLMEEhHAw5Xo3r2187CWykjAtm0", "Google_resource_URI": "https: //www.googleapis.com/calendar/v3/calendars/4e7d5c20ht9lpfdtuukcsvgeq4@group.calendar.google.com/events?alt=json", "Google_resource_state": "sync", "Google_message_number": "1" } 但是这个回应是非常一般的。 例如,如果我在此日历上有1000个事件,并更新完整的1000个事件。 我会收到总是相同的通知1000.我想知道,如果有可能得到哪些事件ID有变化,所以我可以执行和更新到我的数据库。 我启动手表的方式是这样的: exports.watch = function(req, res){ var […]

查找下一个繁忙时间的免费小时

使用Google Calendar API时,需要: start (epoch时间) end (epoch时间) timeZone (即America/Los_Angeles ) 响应是一个名为busy的数组,其中包含{ start <Date>, end<Date>} 我的目标:findstart和end之间的下一个空闲时间。 有以下限制: 必须在工作日(星期一至星期五) 必须在工作时间(上午9时至下午5时) 这是我试过的: 从上午9点到下午5点,每天手动创build更多busy对象 手动为周六和周日创build更多busy对象 合并所有busy街区,所以不会有交集 现在采取相反的时间,这是free时间。 第一个空闲时间对象( {start <Date>,end <Date>} ),其start – end > = 1 hour 是下一个空闲时间。 如果没有free对象大于1小时,则在start和end之间不存在空闲时间 这个问题听起来太多了,我想听听build议 这是我的代码到目前为止(工作): const moment=require('moment-timezone'); const chrono = require('chrono-node'); const ms = require('ms'); /** * given start and end dates […]

如何解决freebusy谷歌日历nodejs api?

我正在尝试使用NodeJS API从Google日历获取忙/闲信息,如https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query所示 。 问题是我得到的唯一错误答案是“无效请求”。 当我用Google的Try It工具运行它时,我能够得到回应。 我知道我正在获得授权客户。 我能做些什么来进一步解决这个问题? 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: […]

Google API NodeJS:calendar.events.watch获取错误push.webhookUrlNotHttps或pushWebhookBadDomain

我已经按照https://developers.google.com/google-apps/calendar/v3/push (我认为)中所需的所有设置,我正在尝试注册我的callbackURL来观看事件,并使用以下代码: calendar.events.watch({ auth:jwtClient, resource: { id: "yourChannelId", type: 'web_hook', address: "https://api.mysite.com/notifications" }, calendarId: "mycalendarId" }, function(error, response) { if (error) { console.log(error); return; } console.log(response); }); 我得到错误message: 'No valid domain for WebHook callback: https://https://api.mysite.com', reason: 'pushWebhookBadDomain' 。 如果我尝试将地址设置为“api.mysite.com/notifications”(因为https看起来是重复的),那么我会收到错误message: 'WebHook callback must be HTTPS: api.mysite.com/notifications', reason: 'push.webhookUrlNotHttps' 任何人都可以帮我吗? 谢谢