i'm using python urllib for making request on Google calendar(API V3).
Now,Problem is that when i make request for 'Events: list',then i got zero items in response although there are events in that calendar.
Example
{ "kind": "calendar#events",
"nextPageToken": "CigKGm83a292ZzZ2YXBsNXRsMHJhZnV2cGprdHVvGAEggIDA97TfuYYUGg0IABIAGOjEqd_6q7kC",
"items": [ ]
}
If i use 'nextPageToken' in next request it works fine.(But i don't want make any Extra request.)
This problem not occur every time. If i create new email_id this works fine. but after one or two month this problem start again.
Is this a bug in Google Calendar API ?
or
Is there any solution to get event list of any calendar in just One Request ?
Thanks in advance.
Corrupted files in the cache Now when these cache files become corrupted, you may see your Google Calendar events disappear. That's because these corrupted files hamper smooth calendar events syncing. Therefore, any changes you made in your Google calendar fail to reflect as an updated calendar.
Open the settings and head to View options. Check the box next to Reduce the brightness of past events. Head back to your calendar, and completed events will stand out less, reducing your overall anxiety at least a little bit.
I've been trying to figure out the same issue and I believe I have the answer.
The issue here is that when Google calculates a 'page' of events to return, it includes the deleted events in that calculation, and your first page is full of deleted events that you don't see unless your request has "showDeleted = True".
I provide a way for the user to 'clear' their calendar and repopulate it and have run into this issue. Consider this scenario:
The user has 250 events in their calendar and for arguments sake, lets say Googles 'page' size the same size.
When the user runs the process to repopulate, these 250 events are removed and 250 'new' events are created.
When we next go to remove the events prior to a repopulate process, the first page returns with no events - this is because the first 250 in the list are those that were deleted originally. (I have verified this by using the API Explorer )
Using the nextPageToken to get the next page of results works - as you have noted.
This is why creating a new calendar works for a period of time - ie until you get over that 'page' limit and start returning 0 events, which is where we run into issues.
Over time and if the user uses this repopulate function a lot, their list of deleted events can become huge and it will require many requests to return all Events. (I know of no way to purge all the deleted events completely from Google Cal - they seem to remain forever)
There is no way I know of to return all events in one call. You need to loop through the process getting a page at a time until the "NextPageToken" is no longer returned. This makes sense, because for users that have huge calendars with 1000's of appointments, it's inefficient to return everything in one request.
Using the Google Calendar API V3 here is a sample of what I'm using in VB.Net to remove all Events. (Service is a Google.Apis.Calendar.v3.CalendarService)
Private Sub ClearAllEvents()
Dim pageToken As String = Nothing
Dim events As Events
Dim qry As New ListRequest(Service, GCalId)
Do
qry.PageToken = pageToken
events = qry.Execute()
For Each ev As [Event] In events.Items
Dim dr As New DeleteRequest(Service, GCalId, ev.Id)
dr.Execute()
Next
pageToken = events.NextPageToken
Loop While Not IsNothing(pageToken)
End Sub
add showDeleted = false and pageToken=next_page_token to url and call the api again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With