Google 日历 - API 响应中缺少 SyncToken

Google Calendar - SyncToken is missing in API response

我在回复中没有看到 nextSyncToken。我按照文档 (https://developers.google.com/calendar/api/guides/sync) 并使用 nextPageToken 分页,但我在最后一页上看不到 nextSyncToken

API 使用:GET /calendars/primary/events?maxResults=10&singleEvents=true&pageToken=********

不知道有没有遗漏什么。谁能帮我解决这个问题?

能否提供 gcalendar API 的回复?没有详细信息很难说更多。我什至不知道您使用的是哪种语言。

  1. 尝试使用供应商库来解决这个问题:

a) https://packagist.org/packages/google/apiclient(对于 PHP)

b) https://www.npmjs.com/package/google-calendar(对于 JavaScript)

and/or

  1. 尝试使用替代端点:GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events

我从另一个答案评论的回复 link 中看到,您正在根据请求使用 orderBy

这就是 nextSyncToken 没有出现的原因。

如文档中所述 Events: list -> 参数 -> syncToken:

Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False. There are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state.

These are:

  • iCalUID
  • orderBy
  • privateExtendedProperty
  • q
  • sharedExtendedProperty
  • timeMin
  • timeMax
  • updatedMin

If the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken. Learn more about incremental synchronization. Optional. The default is to return all entries.

您应该从请求中删除 orderBy 以获得 syncToken