CalendarList: insert

기존 캘린더를 사용자의 캘린더 목록에 삽입합니다. 지금 사용해 보기 또는 예시를 확인하세요.

요청

HTTP 요청

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

매개변수

매개변수 이름 설명
선택적 쿼리 매개변수
colorRgbFormat boolean foregroundColorbackgroundColor 필드를 사용하여 캘린더 색상 (RGB)을 쓸지 여부입니다. 이 기능을 사용하면 색인 기반 colorId 필드가 최적 일치 옵션으로 자동 설정됩니다. 선택사항입니다. 기본값은 False입니다.

승인

다음 범위를 사용하여 이 요청을 인증받아야 합니다.

범위
https://www.googleapis.com/auth/calendar

자세한 내용은 인증 및 승인 페이지를 참고하세요.

요청 본문

요청 본문에 다음과 같은 속성이 지정된 CalendarList 리소스를 제공합니다.

속성 이름 설명 Notes
필수 속성
id string 캘린더의 식별자입니다.
선택적 속성
backgroundColor string 캘린더의 기본 색상(16진수 형식 '#0088aa')입니다. 이 속성은 색인 기반 colorId 속성을 대체합니다. 이 속성을 설정하거나 변경하려면 insert, update, patch 메서드의 매개변수에서 colorRgbFormat=true를 지정해야 합니다. 선택사항입니다. 쓰기 가능
colorId string 캘린더의 색상입니다. 색상 정의의 calendar 섹션에 있는 항목을 참조하는 ID입니다 (색상 엔드포인트 참고). 이 속성은 backgroundColorforegroundColor 속성으로 대체되며 이러한 속성을 사용하는 경우 무시해도 됩니다. 선택사항입니다. 쓰기 가능
defaultReminders[] list 인증된 사용자가 이 캘린더에 대해 보유한 기본 알림입니다. 쓰기 가능
defaultReminders[].method string 이 알림에서 사용되는 메서드입니다. 가능한 값은 다음과 같습니다.
  • "email" - 알림이 이메일로 전송됩니다.
  • 'popup' - 알림이 UI 팝업을 통해 전송됩니다.

알림을 추가할 때 필요합니다.

쓰기 가능
defaultReminders[].minutes integer 이벤트가 시작되기 전에 알림이 트리거되어야 하는 시간(분)입니다. 유효한 값은 0~40320 (분 기준 4주) 사이입니다.

알림을 추가할 때 필요합니다.

쓰기 가능
foregroundColor string 캘린더의 전경색으로, 16진수 형식 "#ffffff"입니다. 이 속성은 색인 기반 colorId 속성을 대체합니다. 이 속성을 설정하거나 변경하려면 insert, update, patch 메서드의 매개변수에서 colorRgbFormat=true를 지정해야 합니다. 선택사항입니다. 쓰기 가능
hidden boolean 캘린더를 목록에서 숨겼는지 여부를 나타냅니다. 선택사항입니다. 이 속성은 캘린더가 숨겨져 있는 경우에만 반환되며, 이 경우 값은 true입니다. 쓰기 가능
notificationSettings object 인증된 사용자가 이 캘린더에 대해 수신하는 알림입니다. 쓰기 가능
notificationSettings.notifications[].method string 알림을 전달하는 데 사용되는 메서드입니다. 가능한 값은 다음과 같습니다.
  • 'email' - 이메일을 통해 알림이 전송됩니다.

알림을 추가할 때 필요합니다.

쓰기 가능
notificationSettings.notifications[].type string 알림의 유형입니다. 가능한 값은 다음과 같습니다.
  • 'eventCreation' - 캘린더에 새 일정이 있으면 알림이 전송됩니다.
  • 'eventChange' - 이벤트가 변경될 때 전송되는 알림
  • 'eventCancellation' - 이벤트가 취소될 때 전송되는 알림
  • 'eventResponse' - 참석자가 일정 초대에 응답하면 알림이 전송됩니다.
  • 'agenda' - 하루의 일정이 포함된 일정목록입니다 (아침에 전송됨).

알림을 추가할 때 필요합니다.

쓰기 가능
selected boolean 캘린더 콘텐츠를 캘린더 UI에 표시할지 여부입니다. 선택사항입니다. 기본값은 False입니다. 쓰기 가능
summaryOverride string 인증된 사용자가 이 캘린더에 설정한 요약입니다. 선택사항입니다. 쓰기 가능

응답

요청에 성공할 경우 이 메서드는 응답 본문에 CalendarList 리소스를 반환합니다.

참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.

Java

자바 클라이언트 라이브러리를 사용합니다.

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']

2,399필리핀

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 탐색기를 사용하여 실시간 데이터를 대상으로 이 메소드를 호출하고 응답을 확인해 보세요.