#next_sync_token fo Google Calendar Events always return nil

守給你的承諾、 提交于 2019-12-13 12:30:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!