4
votes

We are fetching google calendar events through OAuth2 tokens with Google Calendar API V3 to our customers, but for some of customers' calendar getting empty response. We got empty response for the same calendar in Google OAuth Playground.

{
  "nextPageToken": "CjkKK2xwamMycHJ2MDU2cGp2YFxcmY3OXRtNTg0XzIwMTQwMjEyVDA0MzAwMFoYASCAgMDEtcaFoBQaDQgAEgAY2M-X7qfLvAI=", 
  "kind": "calendar#events", 
  "defaultReminders": [
    {
      "minutes": 30, 
      "method": "popup"
    }
  ], 
  "items": [], 
  "updated": "2014-02-14T09:32:57.943Z", 
  "summary": "TEST", 
  "etag": "\"TuPKiPtcUnaxp3U8BefUMu26Bg/LWnnxrAP6L1-mgjBDhy0rIebYaE\"", 
  "timeZone": "Asia/Calcutta", 
  "accessRole": "owner"
}

But when the same user is authenticated through AuthSub, it is fetching the events list. Is anyone having the same issue? Any help would be appreciated.

TIA, Riyaz.A

2

2 Answers

1
votes

Have you tried actually calling the API with the nextPageToken? Usually the client libraries do this auto pagination for you, but in this case you may need to manually make the call. In general, you should plan on calling next pages until nextPageToken is empty or not present.

This might just be an weirdness with the API.

0
votes

We can't set pageToken to the event instance

Calendar.Events.List events = service.build().events().list(gCalId);

But when we try model Events instance, we able to set pageToken and got response too

com.google.api.services.calendar.model.Events events = service.build().events().list(gCalId).setPageToken(pageToken).execute();