사용자의 캘린더 목록에서 기존 캘린더를 업데이트합니다. 지금 사용해 보거나 예를 참조하세요.
요청
HTTP 요청
PUT https://www.googleapis.com/calendar/v3/users/me/calendarList/calendarId
매개변수
매개변수 이름 | 값 | 설명 |
---|---|---|
경로 매개변수 | ||
calendarId |
string |
캘린더 식별자입니다. 캘린더 ID를 검색하려면 calendarList.list 메서드를 호출합니다. 현재 로그인한 사용자의 기본 캘린더에 액세스하려면 "primary " 키워드를 사용하세요.
|
쿼리 매개변수(선택사항) | ||
colorRgbFormat |
boolean |
foregroundColor 및 backgroundColor 필드를 사용하여 캘린더 색상 (RGB)을 작성할지 결정합니다. 이 기능을 사용하면 색인 기준 colorId 필드가 가장 일치하는 옵션으로 자동 설정됩니다. 선택사항. 기본값은 False입니다.
|
확인할 내용
다음 범위를 사용하여 이 요청을 인증받아야 합니다.
범위 |
---|
https://www.googleapis.com/auth/calendar |
자세한 내용은 인증 및 승인 페이지를 참고하세요.
요청 본문
요청 본문에서는 다음과 같은 속성을 사용하여 CalendarList 리소스를 제공합니다.
속성 이름 | 값 | 설명 | 메모 |
---|---|---|---|
선택 속성 | |||
backgroundColor |
string |
16진수 형식("#0088aa ")의 캘린더 기본 색상입니다. 이 속성은 색인 기반 colorId 속성을 대체합니다. 이 속성을 설정하거나 변경하려면 insert, update, patch 메서드의 매개변수에 colorRgbFormat=true 를 지정해야 합니다. 선택사항. |
쓰기 가능 |
colorId |
string |
캘린더의 색상입니다. 색상 정의의 calendar 섹션에 있는 항목을 참조하는 ID입니다 (색상 엔드포인트 참고). 이 속성은 backgroundColor 및 foregroundColor 속성으로 대체되며 이러한 속성을 사용할 때 무시해도 됩니다. 선택사항. |
쓰기 가능 |
defaultReminders[] |
list |
인증된 사용자가 캘린더에 대해 설정한 기본 알림입니다. | 쓰기 가능 |
defaultReminders[].method |
string |
이 알림에서 사용하는 메서드입니다. 가능한 값은 다음과 같습니다.
알림을 추가할 때 필요합니다. |
쓰기 가능 |
defaultReminders[].minutes |
integer |
알림이 시작되기 전에 이벤트가 시작되기까지의 시간(분)입니다. 유효한 값은 0~40,320 (분, 4주)입니다. 알림을 추가할 때 필요합니다. |
쓰기 가능 |
foregroundColor |
string |
16진수 형식("#ffffff ")의 캘린더 전경 색상입니다. 이 속성은 색인 기반 colorId 속성을 대체합니다. 이 속성을 설정하거나 변경하려면 insert, update, patch 메서드의 매개변수에 colorRgbFormat=true 를 지정해야 합니다. 선택사항. |
쓰기 가능 |
notificationSettings |
object |
이 캘린더에 대해 인증된 사용자가 수신하는 알림입니다. | 쓰기 가능 |
notificationSettings.notifications[].method |
string |
알림을 전달하는 데 사용되는 메서드입니다. 가능한 값은 다음과 같습니다.
알림을 추가할 때 필요합니다. |
쓰기 가능 |
notificationSettings.notifications[].type |
string |
알림의 유형입니다. 가능한 값은 다음과 같습니다.
알림을 추가할 때 필요합니다. |
쓰기 가능 |
selected |
boolean |
캘린더 콘텐츠를 캘린더 UI에 표시할지 여부. 선택사항. 기본값은 False입니다. | 쓰기 가능 |
summaryOverride |
string |
인증된 사용자가 이 캘린더에 설정한 요약입니다. 선택사항. | 쓰기 가능 |
응답
요청에 성공할 경우 이 메서드는 응답 본문에 CalendarList 리소스를 반환합니다.
예
참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.
자바
자바 클라이언트 라이브러리를 사용합니다.
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.CalendarListEntry; // ... // Initialize Calendar service with valid OAuth credentials Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials) .setApplicationName("applicationName").build(); // Retrieve the calendar list entry CalendarListEntry calendarListEntry = service.calendarList().get("calendarId").execute(); // Make a change calendarListEntry.setColorId("newColorId"); // Update the altered entry CalendarListEntry updatedCalendarListEntry = service.calendarList().update(calendarListEntry.getId(), calendarListEntry).execute(); System.out.println(updatedCalendarListEntry.getEtag());
Python
Python 클라이언트 라이브러리를 사용합니다.
# 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
PHP 클라이언트 라이브러리를 사용합니다.
// 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
Ruby 클라이언트 라이브러리를 사용합니다.
calendar_list_entry = client.get_calendar_list('calendarId') calendar_list_entry.colorId = 'newColorId' result = client.update_calendar_list(calendar_list_entry.id, calendar_list_entry) print result.etag
사용해 보기
아래의 API 탐색기를 사용하여 실시간 데이터를 대상으로 이 메소드를 호출하고 응답을 확인해 보세요.