Reputation: 1140
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.
Upvotes: 2
Views: 3906
Reputation: 1
I would like to add that providing "id" gives you the eventId.
i.e.:
print event['id']
I had issues going through a list of events, deleting those within my time search. In the google API overview for list the property name "id" is not included. However calling the list method in the explorer (as suggested by accepted answer) shows the property name listed.
Upvotes: 0
Reputation: 5519
When you insert an event through the API, the Events resource returned by the API contains an id
parameter, generated by the API servers.
If you created the event manually, then the eventId is harder to find. You can use the list()
method with the ?q
parameter to search for the event.
I am not a Python developer, but based on these Python examples, I would expect something like this :
service.events().list(calendarId='primary', q='FakeEvent1')
Upvotes: 1
Reputation: 599580
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.
Upvotes: 1