Google Calendar API

CalendarList: update

Requires authorization

Updates an entry on the user's calendar list. Try it now or see an example.

Request

HTTP request

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

Parameters

Parameter name Value Description
Path parameters
calendarId string Calendar identifier.
Optional query parameters
colorRgbFormat boolean Whether to use the 'foregroundColor' and 'backgroundColor' fields to write the calendar colors (RGB). If this feature is used, the index-based 'colorId' field will be set to the best matching option automatically. Optional. The default is False.

Authorization

This request requires authorization with the following scope (read more about authentication and authorization).

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

Request body

In the request body, supply a CalendarList resource with the following properties:

Property name Value Description Notes
Required Properties
defaultReminders[].method string The method used by this reminder. Possible values are:
  • "email" - Reminders are sent via email.
  • "sms" - Reminders are sent via SMS.
  • "popup" - Reminders are sent via a UI popup.
defaultReminders[].minutes integer Number of minutes before the start of the event when the reminder should trigger.
notificationSettings.notifications[].method string The method used to deliver the notification. Possible values are:
  • "email" - Reminders are sent via email.
  • "sms" - Reminders are sent via SMS. This value is read-only and is ignored on inserts and updates.
notificationSettings.notifications[].type string The type of notification. Possible values are:
  • "eventCreation" - Notification sent when a new event is put on the calendar.
  • "eventChange" - Notification sent when an event is changed.
  • "eventCancellation" - Notification sent when an event is cancelled.
  • "eventResponse" - Notification sent when an event is changed.
  • "agenda" - An agenda with the events of the day (sent out in the morning).
Optional Properties
backgroundColor string The main color of the calendar in the format '#0088aa'. This property supersedes the index-based colorId property. Optional. writable
colorId string The color of the calendar. This is an ID referring to an entry in the "calendar" section of the colors definition (see the "colors" endpoint). Optional. writable
defaultReminders[] list The default reminders that the authenticated user has for this calendar. writable
foregroundColor string The foreground color of the calendar in the format '#ffffff'. This property supersedes the index-based colorId property. Optional. writable
hidden boolean Whether the calendar has been hidden from the list. Optional. The default is False. writable
notificationSettings object The notifications that the authenticated user is receiving for this calendar. writable
selected boolean Whether the calendar content shows up in the calendar UI. Optional. The default is False. writable
summaryOverride string The summary that the authenticated user has set for this calendar. Optional. writable

Response

If successful, this method returns a CalendarList resource in the response body.

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.

// First retrieve the calendarListEntry from the API.
CalendarListEntry calendarListEntry = service.calendarList().get("calendarId").execute();
calendarListEntry.setColorId("newColorId");

CalendarListEntry updatedCalendarListEntry =
    service.calendarList().update(calendarListEntry.getId(), calendarListEntry).execute();

System.out.println(updatedCalendarListEntry.getEtag());

Python

Uses the Python client library.

# First retrieve the calendarListEntry from the API.
calendar_list_entry = service.calendarList().get(calendarId='calendarId').execute()
calendar_list_entry['colorId'] = 'newColorId'

updated_calendar_list_entry = service.calendarList().update(
    calendarId=calendar_list_entry['id'], body=calendar_list_entry).execute()

print created_calendar_list_entry['etag']

PHP

Uses the PHP client library.

// First retrieve the calendarListEntry from the API.
$calendarListEntry = $service->calendarList->get('calendarId');
$calendarListEntry->setColorId('newColorId');

$updatedCalendarListEntry = service->calendarList->update($calendarListEntry->getId(), $calendarListEntry);

echo $updatedCalendarListEntry->getEtag();

Ruby

Uses the Ruby client library.

result = client.execute(:api_method => service.calendar_list.get,
                        :parameters => {'calendarId' => 'calendarId'})
calendar_list_entry = result.data
calendar_list_entry.colorId = 'newColorId'
result = client.execute(:api_method => service.calendar_list.update,
                        :parameters => {'calendarId' => calendar_list_entry.id},
                        :body_object => calendar_list_entry,
                        :headers => {'Content-Type' => 'application/json'})
print result.data.etag

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.