问题
I created 3 events in Calendar, then I run
response = @client.execute!(
:api_method => @calendar_api.events.list,
:parameters => {
:calendarId => "primary",
:maxResults => 10,
:singleEvents => true,
:orderBy => 'startTime'}
)
I received 3 items but #next_sync_token method called on response.data returns nil (#next_page_token also returns nil but in this case it is correct). I tried to set :fields parameter to "nextSyncToken" but still nothing. I also made some updates on that events and #next_sync_token was still set to nil..Am I wrong? Maybe I made some mistake ?
The call only with calendarId in parameters do the same.
回答1:
Get rid of orderBy. This isn't documented, but if you try the Google API, you'll see that nextSyncToken isn't returned with orderBy: startTime.
Wasted lots of time on the same issue.
回答2:
The result will only have the next sync token on the last page. You need to go over all the pages (until next_page_token nil) and then you will find a sync token.
来源:https://stackoverflow.com/questions/33999179/next-sync-token-fo-google-calendar-events-always-return-nil