2

I am trying to retrieve events from a Google calendar. I am calling this URL:

GET https://www.googleapis.com/calendar/v3/calendars/riteshmehandiratta%40gmail.com/events

Authorization:  Bearer ya29.AHES6ZSvz3O7V2p7z_k_ZWAiUZqWX35Eyx5V_J4XC5pVSNxLjS6CNzQ

and I am getting this response:

{
 "kind": "calendar#events",
 "etag": "\"ZrhdJMCgpoUK_a5fT7XOC6xn46g/_4_AQ2FVvAtAEiDFDj8_pH_usqc\"",
 "summary": "riteshmehandiratta@gmail.com",
 "updated": "2013-02-18T03:45:37.728Z",
 "timeZone": "Asia/Calcutta",
 "accessRole": "owner",
 "defaultReminders": [
  {
   "method": "email",
   "minutes": 10
  },
  {
   "method": "popup",
   "minutes": 10
  }
 ],
 "nextPageToken": "CigKGnR0ZG1xbjAyNHQ1Y3RycjYwY2x0ZGxtcTk0GAEggIDA28aNo-cT"
}

There are many events in the calendar for the past, future and for the current date.

Why its not giving the calendar event list?

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
mathlearner
  • 7,509
  • 31
  • 126
  • 189

3 Answers3

0

there is definitely something weird here, in the response you are posting, i see you are getting the nextPageToken tag, so there actually ARE more results, you can call the next result "page", using a similar request with the variable pageToken added, something like

GET https://www.googleapis.com/calendar/v3/calendars/riteshmehandiratta%40gmail.com/events?pageToken=CigKGnR0ZG1xbjAyNHQ1Y3RycjYwY2x0ZGxtcTk0GAEggIDA28aNo-cT

that way you'll get more results.

Anyway this is weird because the nextPageToken doesn't show up if you don't limit the query with some variable like maxResults. Please check if you are not limiting the query somewhere else.

Maybe you can find useful for making test, the documentation page, that has at the bottom a request form that can build the query for you.

Hope this helps, regards

ultraklon
  • 590
  • 4
  • 9
0

I saw the same problem. Sometimes the list API will return an empty item list with a nextPageToken, even if I did not limit the number of responses. The solution is to check if there is a nextPageToken, and make another request for the next page until you get a response without a nextPageToken.

rscohn2
  • 899
  • 7
  • 10
-2

I looped through the requests until there wasn't a nextPage token, appending the event lists to a local list, and this provided a full list of the events.

Nimantha
  • 6,405
  • 6
  • 28
  • 69