3
votes

I am trying to query Google's Calendar API to get a list with Events that matches the List with EventIds.

So i have a list of EventIds and i want to get the corresponding events from Google Calendar.

I found the parameter 'q' with the following description:

"Free text search terms to find events that match these terms in any field, except for extended properties. Optional."

It's from this page: https://developers.google.com/google-apps/calendar/v3/reference/events/list

My problem is that i have no idea what to pass into 'q' (no documentation on that page or any reference to where that can be found) and if this parameter can help me get the list back with the specific ids?

1

1 Answers

0
votes

The API method you found is GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events and is used to get a list of all events from a particular calendar. This is done by changing calendarId to the ID of the calendar you want to get events from. q is an optional parameter you can pass when you make this GET request that limits the events returned from the calendar to those events matching a particular search term.

Since you already have a list of eventId's, this is not the method you are looking for. You should instead use the Events.get method: GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId. In this URI, you replace calendarId with the ID of the calendar that has the event and you replace eventId with the particular event id from your list of events. You can make repeated calls to this API URI while changing the eventId each time to get the Event resource for each of the events in your list.

The Events.get method above will work for you, but is not the most efficient way to retrieve your events. You can look into batch requests in the future to group all your API calls together to more efficiently retrieve the events.