I've subscribed on google calendar push notifications (PN). Base synchronization processes using PN. I need to know if all events already loaded in calendar scope or not.
Is it possible to have a special marker in my request answer (request events for specified calendar based on subscribed channel information)?
If calendar has too much events, events will be loaded in few push notifications handling. I need marker for UI if calendar is synchronized completely. In my my usual logic I thought that calendar is already synchronized if first PN per calendar already handled. So I need notify my UI client with correct status (calendar_is_synchronnized, calendar_is_not_synchronnized) but I do not have any markers from google if the PN provides me load last events portion in specified calendar scope.
I haven't got elegant solution for my question. But I've solved issue with double call. The is no special API for this purpose, I've used algorithm:
after updating to sync token I try get all events for same calendar just to be able compare new nextSyncToken with current if it is the same.
if token is different if means the calendar sync is not completed yet.
If any better idea(s), you are welcome.
Related
I would like to now if the following functionality is supported by google calendar api:
Does the functionality provided by "Push notifications" include new events or just existing ones. Here is a copy paste from the documentation that let me doubt that new event notifications are supported "The Google Calendar API provides push notifications that let you watch for changes to resources.". So does this only apply to already existing resources (events on my case).
Is there a way to limit the availability on the google calendar. By this I mean setting a general limit (i.e working hours for a company for example from 9am to 5pm). And putting the logic further, is there a way to add more constraints. For example after I receive a notification of a new event created (if this functionality is provided), I check the event's data in my web-hook and let google calendar know that this event shouldn't be considered as valid.
If these requirements are not provided already by google calendar API, I am open to any suggestions to accomplish this even if it takes more coding.
Just to make it clear. The context of these questions is when the user creates an event in their google calendar through google calendar web interface not through my application.
I'm using calendar API to pull events of users in an organization that had installed my GSuite app as a service account (it just means that I have access to all the users in the organization).
I noticed some weird behavior - let's say I have an event with 2 participants - a and b (both are users in the company). when I use the calendar API events.list to pull event for a I get this event, and b is listed in the attendee list with responseStatus of 'accepted'.
When I pull the events for the same period of time for user b, I do not get this meeting, nor when I try to pull a specific event using the meeting id (event.get API). I also used showDeleted=True but still didn't get the event back when pulling the events of b (I'm pretty sure if the event would have been deleted then the responseStatus would have been 'decline').
What could be the reason for this behavior? I tried to reproduce it using two emails that I have access to, and I was not successful.
Since those are emails of my client I cannot just come up to them and ask what happened with this meeting.
This is the request I'm making (using python google API client):
from googleapiclient.discovery import build as Build
service = Build("calendar", "v3", credentials=credentials, cache_discovery=False)
service.events().list(calendarId='primary', timeMin=min_time, timeMax=max_time, pageToken=page_token, singleEvents=True).execute()
First I'm building the service using the service account credentials (delegating permissions to the current email), and then making the request to pull the events.
The min_time,max_time are strings like this - 2020-10-19T08:00:00+0000.
The pageToken starts as None but will change if there is a nextPageToken in the response.
This is the request I made to try and get the meeting of the user that appear as an attendee when pulling the event using another user's email & credentials:
service.events().get(calendarId='primary', eventId=<meeting_id>).execute()
But I'm getting 404 event not found response (This API returns deleted events - I've seen it)
I'm pulling all of the events correctly, and only saw this case on small number of the events (less than 5% of the meetings).
Any idea what could cause this?
Thanks!
I'd like for my app to add/delete/update events on a user's Google Calendar. The app only needs to delete and update events that the app itself has added.
Have I understood it correctly, that in order for this to work, the users have to give the app full access to their Google Calendars, meaning that the app could potentially read and delete private events on any calendar?
Or, is there a way to limit the access that a user gives to the app, for example, allowing the app to create a single calendar and only giving it access to events on that one calendar?
I've read through the relevant Google Calendar API, and I'm not seeing that this is possible. However, giving full access seems crazy and unnecessary!
It seems that this isn't possible. Google, why!?
What I ended up doing was skipping the API and using a calendar subscription. Limited use since the user needs to be able to set up a subscription and, especially, because Google takes up to a day to update subscribed calendars.
I am using Google Calendar API and push notifications to add channels and watch those channels for new events that come in. However while tracking weird behavior with mixing calendar accounts and events I found out that the resource ID that the calendar API responded with is the same across two accounts.
I am not sure if this is the culprit yet but this is the definition of resource-ID from docs
X-Goog-Resource-ID - An opaque value that identifies the watched
resource. This ID is stable across API versions.
In my mind this means it should be unique. Resource-ID and channel-ID are a requirement for stopping channels after all.
Examples of identical resource-ID from google for two different accounts
Account 1
X-Goog-Resource-State: exists
X-Goog-Channel-Token: 56cab177e67348d9a17c7502a4bad513
X-Goog-Resource-ID: 8KXz6YKChAJDYMTUo0SoKqV8_7E
X-Goog-Channel-ID: ++7mlvx6pEIsTNeMpMwNLw==
Account 2
X-Goog-Resource-State: exists
X-Goog-Channel-Token: 4535832bc5cf47f7ae3403c404023bfd
X-Goog-Resource-ID: 8KXz6YKChAJDYMTUo0SoKqV8_7E
X-Goog-Channel-ID: mL+HzrG8/EYc7zRZdQ+6yw==
My question is, is this normal behaviour?
The push notifications channel does not provide updates on individual events. It only tells you when the calendar (collection of events) changed.
To find changes to events, you want to look up syncing.
With syncing, you send in a token you got from the last time you synced to the List API endpoint. Instead of listing all events, it will list only the ones that changed since your last since request, represented by the sync token.
You can POST to the List API any time you want to get changes to events, but the push notifications you described help tell you when there would be a meaningful change to call the sync.
I'm trying to fetch all events from a Google calendar using V3 API. I've noticed an issue regarding recurring events.
For some recurring events, on some calendars, only the first instances are fetched (for example - first 5 out of total of 8 instances are fetched).
Few additional details:
I've double checked that the query date-range is correct.
Problem occurred few times - for different Google Apps organizations.
Problem occurs also if I try to fetch the events from the calendar of the event creator.
We are using Google's python library for fetching.
Any inputs will be appreciated. Thanks!
You should set the "singleEvents" flag to True when calling the the API's 'list' command.
From the API documentation:
Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.