【问题标题】:Get event info from resource id on push notification google calendar从推送通知谷歌日历上的资源 id 获取事件信息
【发布时间】:2017-10-03 14:00:52
【问题描述】:
  1. 使用谷歌日历设置频道。
  2. 创建一个谷歌日历活动。
  3. 收到包含以下数据的推送通知。
  4. X-Goog-Resource-Id,X-Goog-Resource-Uri,X-Goog-Channel-Id

现在我找不到如何获取,修改了哪些事件数据或创建了某些事件。

如何通过推送通知标头数据查找事件列表(在第 4 行中提到。)

【问题讨论】:

    标签: php calendar google-calendar-api


    【解决方案1】:

    标头数据中没有更改的资源/事件列表。谷歌只是让你知道你的日历发生了一些变化。

    要在每次 Google Post 请求后获取更改的资源,您需要使用 syncToken 列出来自 google 的日历事件,并保存新的事件,该事件将显示为 nextSyncToken 作为响应。如果您在请求中提供syncToken 参数,您将只能获得从syncToken 到现在的更改。谷歌将此过程称为incremental sync

    https://developers.google.com/google-apps/calendar/v3/sync#incremental_sync

    请从这里读取syncTokennextSyncToken 参数:https://developers.google.com/google-apps/calendar/v3/reference/events/list

    其他链接:How to handle Google Calendar API push notifications?

    【讨论】:

    • 谢谢 :) 它真的帮助了我。我只是用“syncToken”参数触发“listEvents”函数,它对我有用。 $events = $service->events->listEvents("--calendar_id--", array('syncToken'=>''));
    猜你喜欢
    • 1970-01-01
    • 2016-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多