-->

Get event info from resource id on push notificati

2019-05-25 04:53发布

问题:

  1. Set channel with google calendar.
  2. Create a google calendar event.
  3. got a push notification contains following data.
  4. X-Goog-Resource-Id,X-Goog-Resource-Uri,X-Goog-Channel-Id

Now i could not find how to get, which event data modified or some event has been created.

How can I find event list by push notification headers data (mentioned in line 4.)

回答1:

There is no changed resource/event list in header data. Google just lets you know that something has changed in your calendar.

To get changed resources after every Google Post request, you need to list events of your calendar from google with syncToken and save the new one which will appear as nextSyncToken in response. If you provide syncToken parameter in your request, you will only get the changes from syncToken to now. Google calls this process incremental sync.

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

please read syncToken and nextSyncToken parameters from here: https://developers.google.com/google-apps/calendar/v3/reference/events/list

Additional links: How to handle Google Calendar API push notifications?