사용자의 캘린더 목록에 기존 캘린더를 삽입합니다. 지금 사용해 보거나 예를 참조하세요.
요청
HTTP 요청
POST https://www.googleapis.com/calendar/v3/users/me/calendarList
매개변수
매개변수 이름 | 값 | 설명 |
---|---|---|
쿼리 매개변수(선택사항) | ||
colorRgbFormat |
boolean |
foregroundColor 및 backgroundColor 필드를 사용하여 캘린더 색상 (RGB)을 작성할지 결정합니다. 이 기능을 사용하면 색인 기준 colorId 필드가 가장 일치하는 옵션으로 자동 설정됩니다. 선택사항. 기본값은 False입니다.
|
확인할 내용
다음 범위를 사용하여 이 요청을 인증받아야 합니다.
범위 |
---|
https://www.googleapis.com/auth/calendar |
자세한 내용은 인증 및 승인 페이지를 참고하세요.
요청 본문
요청 본문에서는 다음과 같은 속성을 사용하여 CalendarList 리소스를 제공합니다.
속성 이름 | 값 | 설명 | 메모 |
---|---|---|---|
필수 속성 | |||
id |
string |
캘린더의 식별자입니다. | |
선택 속성 | |||
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(); // Create a new calendar list entry CalendarListEntry calendarListEntry = new CalendarListEntry(); calendarListEntry.setId("calendarId"); // Insert the new calendar list entry CalendarListEntry createdCalendarListEntry = service.calendarList().insert(calendarListEntry).execute(); System.out.println(createdCalendarListEntry.getSummary());
Python
Python 클라이언트 라이브러리를 사용합니다.
calendar_list_entry = { 'id': 'calendarId' } created_calendar_list_entry = service.calendarList().insert(body=calendar_list_entry).execute() print created_calendar_list_entry['summary']
PHP
PHP 클라이언트 라이브러리를 사용합니다.
$calendarListEntry = new Google_Service_Calendar_CalendarListEntry(); $calendarListEntry->setId("calendarId"); $createdCalendarListEntry = $service->calendarList->insert($calendarListEntry); echo $createdCalendarListEntry->getSummary();
Ruby
Ruby 클라이언트 라이브러리를 사용합니다.
entry = Google::Apis::CalendarV3::CalendarListEntry.new( id: 'calendarId' ) result = client.insert_calendar_list(entry) print result.summary
사용해 보기
아래의 API 탐색기를 사용하여 실시간 데이터를 대상으로 이 메소드를 호출하고 응답을 확인해 보세요.