Google Calendar API

CalendarList: list

Requires authorization

Returns entries on the user's calendar list. Try it now or see an example.

Request

HTTP request

GET https://www.googleapis.com/calendar/v3/users/me/calendarList

Parameters

Parameter name Value Description
Optional query parameters
maxResults integer Maximum number of entries returned on one result page. Optional.
minAccessRole string The minimum access role for the user in the returned entires. Optional. The default is no restriction.

Acceptable values are:
  • "freeBusyReader": The user can read free/busy information.
  • "owner": The user can read and modify events and access control lists.
  • "reader": The user can read events that are not private.
  • "writer": The user can read and modify events.
pageToken string Token specifying which result page to return. Optional.
showHidden boolean Whether to show hidden entries. Optional. The default is False.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/calendar

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "calendar#calendarList",
  "etag": etag,
  "nextPageToken": string,
  "items": [
    calendarList Resource
  ]
}
Property name Value Description Notes
kind string Type of the collection ("calendar#calendarList").
etag etag ETag of the collection.
nextPageToken string Token used to access the next page of this result.
items[] list Calendars that are present on the user's calendar list.

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Java

Uses the Java client library.

String pageToken = null;
do {
  calendarList = service.calendarList().list().setPageToken(pageToken).execute();
  List<CalendarListEntry> items = calendarList.getItems();

  for (CalendarListEntry calendarListEntry : items) {
    System.out.println(calendarListEntry.getSummary());
  }
  pageToken = calendarList.getNextPageToken();
} while (pageToken != null);

Python

Uses the Python client library.

page_token = None
while True:
  calendar_list = service.calendarList().list(pageToken=page_token).execute()
  for calendar_list_entry in calendar_list['items']:
    print calendar_list_entry['summary']
  page_token = calendar_list.get('nextPageToken')
  if not page_token:
    break

PHP

Uses the PHP client library.

$calendarList = $service->calendarList->listCalendarList();

while(true) {
  foreach ($calendarList->getItems() as $calendarListEntry) {
    echo $calendarListEntry->getSummary();
  }
  $pageToken = $calendarList->getNextPageToken();
  if ($pageToken) {
    $optParams = array('pageToken' => $pageToken);
    $calendarList = $service->calendarList->listCalendarList($optParams);
  } else {
    break;
  }
}

Ruby

Uses the Ruby client library.

page_token = nil
result = client.execute(:api_method => service.calendar_list.list)
while true
  entries = result.data.items
  entries.each do |e|
    print e.summary + "\n"
  end
  if !(page_token = result.data.next_page_token)
    break
  end
  result = client.execute(:api_method => service.calendar_list.list,
                          :parameters => {'pageToken' => page_token})
end

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.