javagoogle-calendar-apiclient-library

Query events from Google Calendar API v3 using Java client library?


v1 Calendar API client library that my project used for years (and which is being shut down in a couple of weeks) had a clearly defined CalendarQuery, however, v3 doesn't seem to have any client library objects dedicated for this purpose.

Of course, I can use their JSON HTTP request and parse the response, but it would be a shame to do if the client library can do it.

Anyone out there found the way to provide query parameters to list() call?

UPDATE (based on user32116's comments):

So the missing piece is that list() and execute() can and need to be separated.

Actual query code will look like this:

Calendar.Events.List events = calendarClient.events().list(id);

events.setTimeMin(start);
events.setTimeMax(end);
events.set... // your criteria here

Events result = events.execute();

Solution

  • Well they do have examples of how to query calendars and events. See here: https://developers.google.com/google-apps/calendar/v3/reference/events/list#examples

    The old API used CalendarQuery to query events, in the new version Calendar.Events.List is used.