google-app-enginepython-2.7google-calendar-apievent-id

Where can I find the eventId in a Google Calendar?


There's a method posted here which purportedly enables an app to get an event (copied below for convenience). The event, the link claims will be returned with its resources.

event = service.events().get(calendarId='primary', eventId='eventId').execute()

print event['summary']

What should I provide in place of the string eventId? I created fake events on my calendar (e.g. FakeEvent1 and FakeEvent2) but using FakeEvent2 as a string results in the error event not found.

I know for sure that I am successfully communicating with the Calendar API, because when I use the list method, it returns a list which indeed contains FakeEvent2. The problem is, the name of the event cannot be used as the string 'eventId'. I even tried replacing the name of the event with different properties returned during the list call, like event description and event etag, but to no avail.


Solution

  • You can get that from the list method, as demonstrated on the documentation page you link to for that method. At the bottom of that page, there is an API explorer: click "Authorise requests" and accept the popup, then put in "primary" in the calendarId field and click execute. You'll see a list of events in your calendar, each of which has an "id" field: you can use that ID in your get method.