小编Gui*_*zar的帖子

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

我一直在实现谷歌日历api的一些功能。我有一个可以与谷歌日历同步的自定义日历。这意味着,您可以从我的仪表板到谷歌日历帐户创建和编辑日历和事件。我面临的主要问题是,如果我直接从我的谷歌日历更新事件。我已经实现了推送通知并得到如下响应:

    {
      "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"
   }
Run Code Online (Sandbox Code Playgroud)

但是这个回答很笼统。例如,如果我在此日历上有 1000 个事件,并更新完整的 1000 个事件。我将始终收到相同的通知 1000。我想知道,是否可以获取更改的事件 ID,以便我可以执行并更新我的数据库。

我初始化手表的方式是这样的:

    exports.watch = function(req, res){
       var channel_id       = uuid.v1();
       var user_id      = req.body.user_id;
       var calendar_id     = req.body.calendar_id;

       authorize(user_id, function(oauth2Client){
          var data = {
             auth: oauth2Client,
             calendarId: calendar_id, 
             resource: {
                id: channel_id, …
Run Code Online (Sandbox Code Playgroud)

calendar google-calendar-api node.js

1
推荐指数
1
解决办法
1058
查看次数

标签 统计

calendar ×1

google-calendar-api ×1

node.js ×1