Events: import

Requires authorization 承認が必要

Imports an event. This operation is used to add a private copy of an existing event to a calendar. Try it now or see an example. イベントをインポートします。この操作は、既存の予定のプライベートコピーをカレンダーに追加するために使用されます。今すぐ試す、例を見てください

Request要求

HTTP requestHTTPリクエスト

POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/import

Parametersパラメーター

Parameter nameパラメータ名 Value Description説明
Path parametersパスパラメータ
calendarId string Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword. カレンダーID カレンダーIDを取得するには、calendarList.listメソッドを呼び出します。現在ログインしているユーザーのメインカレンダーにアクセスしたい場合は、primaryキーワード" "を使用してください。
Optional query parametersオプションのクエリパラメータ
conferenceDataVersion integer Version number of conference data supported by the API client. Version 0 assumes no conference data support and ignores conference data in the event's body. Version 1 enables support for copying of ConferenceData as well as for creating new conferences using the createRequest field of conferenceData. The default is 0. Acceptable values are 0 to 1, inclusive. APIクライアントによってサポートされている会議データのバージョン番号。バージョン0では、会議データがサポートされていないと想定し、イベント本体の会議データを無視します。バージョン1では、ConferenceDataのコピーをサポートし、conferenceDataのcreateRequestフィールドを使用して新しい会議を作成することもできます。デフォルトは0です。許容値は0to 1です。
supportsAttachments boolean Whether API client performing operation supports event attachments. Optional. The default is False. 操作を実行しているAPIクライアントがイベント添付をサポートするかどうか。オプションです。デフォルトはFalseです。

Authorization承認

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).この要求には、以下の範囲のうちの少なくとも1つを使用した許可が必要です(認証および許可について詳しく読む)。

Scope範囲
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.events

Request bodyリクエストボディ

In the request body, supply an Events resource with the following properties:リクエストボディで、次のプロパティを持つEventsリソースを指定します。

Property nameプロパティ名 Value Description説明 Notesノート
Required Properties必要なプロパティ
end nested object The (exclusive) end time of the event. For a recurring event, this is the end time of the first instance.イベントの(排他的)終了時刻。定期的なイベントの場合、これは最初のインスタンスの終了時刻です。
iCalUID string Event unique identifier as defined in RFC5545. It is used to uniquely identify events accross calendaring systems and must be supplied when importing events via the import method.

Note that the icalUID and the id are not identical and only one of them should be supplied at event creation time. One difference in their semantics is that in recurring events, all occurrences of one event have different ids while they all share the same icalUIDs.ことに注意してくださいicalUIDid同じだけそのうちの一つは、イベントの作成時に提供されるべきではありません。セマンティクスの違いの1つは、繰り返しイベントでは、1つのイベントのすべての発生が異なるidsを持ち、それらがすべて同じicalUIDsを共有することです。

start nested object The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance.イベントの(包括的な)開始時刻。定期的な予定の場合、これは最初のインスタンスの開始時間です。
Optional Propertiesオプションのプロパティ
anyoneCanAddSelf boolean Whether anyone can invite themselves to the event (currently works for Google+ events only). Optional. The default is False.誰でも自分自身をイベントに招待できるかどうか(現在はGoogle+のイベントでのみ機能します)。オプションです。デフォルトはFalseです。 writable 書き込み可能
attachments[].fileUrl string URL link to the attachment.

For adding Google Drive file attachments use the same format as in alternateLink property of the Files resource in the Drive API.

Required when adding an attachment.Google Driveの添付ファイルを追加するには、Drive APIのリソースのalternateLinkプロパティと同じ形式を使用しFilesます。

添付ファイルを追加するときに必要です。

writable 書き込み可能
attendees[] list The attendees of the event. See the Events with attendees guide for more information on scheduling events with other calendar users.イベントの参加者 他のカレンダユーザとのイベントのスケジュール設定の詳細については、参加者とイベントガイドを参照してください。 writable 書き込み可能
attendees[].additionalGuests integer Number of additional guests. Optional. The default is 0.追加ゲストの数 オプションです。デフォルトは0です。 writable 書き込み可能
attendees[].comment string The attendee's response comment. Optional.参加者の回答コメント。オプションです。 writable 書き込み可能
attendees[].displayName string The attendee's name, if available. Optional.利用可能な場合は出席者の名前。オプションです。 writable 書き込み可能
attendees[].email string The attendee's email address, if available. This field must be present when adding an attendee. It must be a valid email address as per RFC5322.

Required when adding an attendee.出席者を追加するときに必要です。

writable 書き込み可能
attendees[].optional boolean Whether this is an optional attendee. Optional. The default is False.これがオプションの参加者かどうか。オプションです。デフォルトはFalseです。 writable 書き込み可能
attendees[].resource boolean Whether the attendee is a resource. Can only be set when the attendee is added to the event for the first time. Subsequent modifications are ignored. Optional. The default is False.出席者がリソースかどうか 参加者が初めてイベントに追加されたときにのみ設定できます。それ以降の変更は無視されます。オプションです。デフォルトはFalseです。 writable 書き込み可能
attendees[].responseStatus string The attendee's response status. Possible values are:
  • "needsAction" - The attendee has not responded to the invitation." needsAction" - 出席者は招待状に返信していません。
  • "declined" - The attendee has declined the invitation." declined" - 出席者は招待を辞退しました。
  • "tentative" - The attendee has tentatively accepted the invitation." tentative" - 出席者は招待状を暫定的に承認しました。
  • "accepted" - The attendee has accepted the invitation." accepted" - 出席者は招待を承認しました。
writable 書き込み可能
attendeesOmitted boolean Whether attendees may have been omitted from the event's representation. When retrieving an event, this may be due to a restriction specified by the maxAttendee query parameter. When updating an event, this can be used to only update the participant's response. Optional. The default is False.出席者がイベントの表現から省略された可能性があるかどうか。イベントを取得するとき、これはmaxAttendeequeryパラメータで指定された制限が原因である可能性があります。イベントを更新するとき、これは参加者の応答を更新するためだけに使用できます。オプションです。デフォルトはFalseです。 writable 書き込み可能
colorId string The color of the event. This is an ID referring to an entry in the event section of the colors definition (see the colors endpoint). Optional.イベントの色 これはevent色の定義のセクションのエントリを参照するIDです(色の終点を参照)。オプションです。 writable 書き込み可能
conferenceData nested object The conference-related information, such as details of a Hangouts Meet conference. To create new conference details use the createRequest field. To persist your changes, remember to set the conferenceDataVersion request parameter to 1 for all event modification requests.ハングアウト会議の詳細など、会議関連の情報。新しい会議の詳細を作成するには、このcreateRequestフィールドを使用します。変更を保持するには、すべてのイベント変更要求に対してconferenceDataVersionrequestパラメータをに設定することを忘れないでください1 writable 書き込み可能
description string Description of the event. Optional.イベントの説明 オプションです。 writable 書き込み可能
end.date date The date, in the format "yyyy-mm-dd", if this is an all-day event.終日イベントの場合は "yyyy-mm-dd"の形式の日付。 writable 書き込み可能
end.dateTime datetime The time, as a combined date-time value (formatted according to RFC3339). A time zone offset is required unless a time zone is explicitly specified in timeZone.日付と時刻の組み合わせの値としての時刻(RFC 3339に従ってフォーマットされたもの)。でタイムゾーンが明示的に指定されていない限り、タイムゾーンオフセットが必要ですtimeZone writable 書き込み可能
end.timeZone string The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) For recurring events this field is required and specifies the time zone in which the recurrence is expanded. For single events this field is optional and indicates a custom time zone for the event start/end.時間が指定されているタイムゾーン。(IANAタイムゾーンデータベース名としてフォーマットされます、例えば、 "Europe / Zurich")。定期的なイベントの場合、このフィールドは必須であり、繰り返しが展開されるタイムゾーンを指定します。単一イベントの場合、このフィールドはオプションであり、イベントの開始/終了のカスタムタイムゾーンを示します。 writable 書き込み可能
extendedProperties.private object Properties that are private to the copy of the event that appears on this calendar.このカレンダーに表示されるイベントのコピーに固有のプロパティ。 writable 書き込み可能
extendedProperties.shared object Properties that are shared between copies of the event on other attendees' calendars.他の出席者のカレンダーの予定のコピー間で共有されるプロパティ。 writable 書き込み可能
gadget.display string The gadget's display mode. Optional. Possible values are:
  • "icon" - The gadget displays next to the event's title in the calendar view." icon" - ガジェットはカレンダービューで予定のタイトルの横に表示されます。
  • "chip" - The gadget displays when the event is clicked." chip" - イベントがクリックされるとガジェットが表示されます。
writable 書き込み可能
gadget.height integer The gadget's height in pixels. The height must be an integer greater than 0. Optional.ガジェットの高さ(ピクセル単位)。高さは0より大きい整数でなければなりません。 writable 書き込み可能
gadget.preferences object Preferences.設定 writable 書き込み可能
gadget.title string The gadget's title.ガジェットのタイトル。 writable 書き込み可能
gadget.type string The gadget's type.ガジェットの種類。 writable 書き込み可能
gadget.width integer The gadget's width in pixels. The width must be an integer greater than 0. Optional.ガジェットの幅(ピクセル単位)。幅は0より大きい整数でなければなりません。 writable 書き込み可能
guestsCanInviteOthers boolean Whether attendees other than the organizer can invite others to the event. Optional. The default is True.開催者以外の出席者が他の人をイベントに招待できるかどうか。オプションです。デフォルトはTrueです。 writable 書き込み可能
guestsCanModify boolean Whether attendees other than the organizer can modify the event. Optional. The default is False.開催者以外の出席者が予定を変更できるかどうか。オプションです。デフォルトはFalseです。 writable 書き込み可能
guestsCanSeeOtherGuests boolean Whether attendees other than the organizer can see who the event's attendees are. Optional. The default is True.開催者以外の出席者が、イベントの出席者が誰であるかを確認できるかどうか。オプションです。デフォルトはTrueです。 writable 書き込み可能
location string Geographic location of the event as free-form text. Optional.自由形式のテキストとしてのイベントの地理的位置。オプションです。 writable 書き込み可能
organizer object The organizer of the event. If the organizer is also an attendee, this is indicated with a separate entry in attendees with the organizer field set to True. To change the organizer, use the move operation. Read-only, except when importing an event.イベントの主催者。開催者も出席者である場合、これは、Trueに設定されattendeesorganizerフィールドを持つ別のエントリで示されます。開催者を変更するには、移動操作を使用します。イベントをインポートする場合を除き、読み取り専用です。 writable 書き込み可能
organizer.displayName string The organizer's name, if available.開催者の名前(もしあれば)。 writable 書き込み可能
organizer.email string The organizer's email address, if available. It must be a valid email address as per RFC5322.開催者のEメールアドレス(もしあれば)。それはRFC5322に従って有効なEメールアドレスでなければなりません。 writable 書き込み可能
originalStartTime.date date The date, in the format "yyyy-mm-dd", if this is an all-day event.終日イベントの場合は "yyyy-mm-dd"の形式の日付。 writable 書き込み可能
originalStartTime.dateTime datetime The time, as a combined date-time value (formatted according to RFC3339). A time zone offset is required unless a time zone is explicitly specified in timeZone.日付と時刻の組み合わせの値としての時刻(RFC 3339に従ってフォーマットされたもの)。でタイムゾーンが明示的に指定されていない限り、タイムゾーンオフセットが必要ですtimeZone writable 書き込み可能
originalStartTime.timeZone string The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) For recurring events this field is required and specifies the time zone in which the recurrence is expanded. For single events this field is optional and indicates a custom time zone for the event start/end.時間が指定されているタイムゾーン。(IANAタイムゾーンデータベース名としてフォーマットされます、例えば、 "Europe / Zurich")。定期的なイベントの場合、このフィールドは必須であり、繰り返しが展開されるタイムゾーンを指定します。単一イベントの場合、このフィールドはオプションであり、イベントの開始/終了のカスタムタイムゾーンを示します。 writable 書き込み可能
recurrence[] list List of RRULE, EXRULE, RDATE and EXDATE lines for a recurring event, as specified in RFC5545. Note that DTSTART and DTEND lines are not allowed in this field; event start and end times are specified in the start and end fields. This field is omitted for single events or instances of recurring events.RFC5545で指定されているように、繰り返しイベントのRRULE、EXRULE、RDATEおよびEXDATE行のリスト。DTSTART行とDTEND行はこのフィールドには使用できないことに注意してください。イベントの開始時間と終了時間はstartand endフィールドで指定します。このフィールドは、単一のイベントまたは定期的なイベントのインスタンスでは省略されます。 writable 書き込み可能
reminders.overrides[] list If the event doesn't use the default reminders, this lists the reminders specific to the event, or, if not set, indicates that no reminders are set for this event. The maximum number of override reminders is 5.イベントでデフォルトのアラームが使用されていない場合は、イベントに固有のアラームが一覧表示されます。設定されていない場合は、このイベントにアラームが設定されていないことを示します。上書きアラームの最大数は5です。 writable 書き込み可能
reminders.overrides[].method string The method used by this reminder. Possible values are:
  • "email" - Reminders are sent via email." email" - リマインダは電子メールで送信されます。
  • "sms" - Deprecated. Once this feature is shutdown, the API will no longer return reminders using this method. Any newly added SMS reminders will be ignored. See Google Calendar SMS notifications to be removed for more information.

    Reminders are sent via SMS. These are only available for G Suite customers. Requests to set SMS reminders for other account types are ignored.通知はSMS経由で送信されます。これらはG Suiteのお客様のみご利用いただけます。他の種類のアカウントにSMSリマインダーを設定する要求は無視されます。

  • "popup" - Reminders are sent via a UI popup." popup" - リマインダーはUIポップアップを介して送信されます。

Required when adding a reminder.アラームを追加するときに必要です。

writable 書き込み可能
reminders.overrides[].minutes integer Number of minutes before the start of the event when the reminder should trigger. Valid values are between 0 and 40320 (4 weeks in minutes).

Required when adding a reminder.アラームを追加するときに必要です。

writable 書き込み可能
reminders.useDefault boolean Whether the default reminders of the calendar apply to the event.カレンダーのデフォルトのアラームが予定に適用されるかどうか。 writable 書き込み可能
sequence integer Sequence number as per iCalendar.iCalendarによるシーケンス番号 writable 書き込み可能
source.title string Title of the source; for example a title of a web page or an email subject.ソースのタイトル たとえば、Webページのタイトルや電子メールの件名などです。 writable 書き込み可能
source.url string URL of the source pointing to a resource. The URL scheme must be HTTP or HTTPS.リソースを指しているソースのURL。URLスキームはHTTPまたはHTTPSでなければなりません。 writable 書き込み可能
start.date date The date, in the format "yyyy-mm-dd", if this is an all-day event.終日イベントの場合は "yyyy-mm-dd"の形式の日付。 writable 書き込み可能
start.dateTime datetime The time, as a combined date-time value (formatted according to RFC3339). A time zone offset is required unless a time zone is explicitly specified in timeZone.日付と時刻の組み合わせの値としての時刻(RFC 3339に従ってフォーマットされたもの)。でタイムゾーンが明示的に指定されていない限り、タイムゾーンオフセットが必要ですtimeZone writable 書き込み可能
start.timeZone string The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) For recurring events this field is required and specifies the time zone in which the recurrence is expanded. For single events this field is optional and indicates a custom time zone for the event start/end.時間が指定されているタイムゾーン。(IANAタイムゾーンデータベース名としてフォーマットされます、例えば、 "Europe / Zurich")。定期的なイベントの場合、このフィールドは必須であり、繰り返しが展開されるタイムゾーンを指定します。単一イベントの場合、このフィールドはオプションであり、イベントの開始/終了のカスタムタイムゾーンを示します。 writable 書き込み可能
status string Status of the event. Optional. Possible values are:
  • "confirmed" - The event is confirmed. This is the default status." confirmed" - イベントは確認されました。これがデフォルトのステータスです。
  • "tentative" - The event is tentatively confirmed." tentative" - このイベントは暫定的に確認されています。
  • "cancelled" - The event is cancelled (deleted). The list method returns cancelled events only on incremental sync (when syncToken or updatedMin are specified) or if the showDeleted flag is set to true. The get method always returns them.

    A cancelled status represents two different states depending on the event type:

    1. Cancelled exceptions of an uncancelled recurring event indicate that this instance should no longer be presented to the user. Clients should store these events for the lifetime of the parent recurring event.

      Cancelled exceptions are only guaranteed to have values for the id, recurringEventId and originalStartTime fields populated. The other fields might be empty. キャンセル済みステータスは、イベントタイプに応じて2つの異なるステータスを表します。

      原文


      1. キャンセルされていない繰り返しイベントのキャンセルされた例外は、このインスタンスがユーザに提示されなくなったことを示します。クライアントは、親の定期的な予定の存続期間中、これらの予定を保存する必要があります。

        キャンセルされた例外はidrecurringEventIdおよびoriginalStartTimeフィールドの値が設定されていることだけが保証されています。他のフィールドは空の可能性があります。

      2. All other cancelled events represent deleted events. Clients should remove their locally synced copies. Such cancelled events will eventually disappear, so do not rely on them being available indefinitely.

        Deleted events are only guaranteed to have the id field populated. 削除されたイベントは、そのidフィールドにデータが取り込まれることだけが保証されています。

      On the organizer's calendar, cancelled events continue to expose event details (summary, location, etc.) so that they can be restored (undeleted). Similarly, the events to which the user was invited and that they manually removed continue to provide details. However, incremental sync requests with showDeleted set to false will not return these details.

      If an event changes its organizer (for example via the move operation) and the original organizer is not on the attendee list, it will leave behind a cancelled event where only the id field is guaranteed to be populated. 予定の開催者が変更され(移動操作などによって)、元の開催者が出席者リストに含まれていない場合は、idフィールドのみの入力が保証されているキャンセルされた予定が残ります。

writable 書き込み可能
summary string Title of the event.イベントのタイトル writable 書き込み可能
transparency string Whether the event blocks time on the calendar. Optional. Possible values are:
  • "opaque" - Default value. The event does block time on the calendar. This is equivalent to setting Show me as to Busy in the Calendar UI." opaque" - デフォルト値。イベントはカレンダーの時間をブロックします。これは、カレンダーのUIで[ 自分を表示]を[ 通話中] に設定するのと同じです。
  • "transparent" - The event does not block time on the calendar. This is equivalent to setting Show me as to Available in the Calendar UI." transparent" - 予定はカレンダーの時間をブロックしません。これは、カレンダーUIで[ 自分に表示]を[ 使用可能]に設定するのと同じです。
writable 書き込み可能
visibility string Visibility of the event. Optional. Possible values are:
  • "default" - Uses the default visibility for events on the calendar. This is the default value." default" - カレンダー上の予定のデフォルトの表示設定を使用します。これがデフォルト値です。
  • "public" - The event is public and event details are visible to all readers of the calendar." public" - 予定は公開されており、予定の詳細はカレンダーのすべての読者に表示されます。
  • "private" - The event is private and only event attendees may view event details." private" - 予定は非公開で、予定の出席者だけが予定の詳細を閲覧できます。
  • "confidential" - The event is private. This value is provided for compatibility reasons." confidential" - 予定は非公開です。この値は互換性のために提供されています。
writable 書き込み可能

Response応答

If successful, this method returns an Events resource in the response body.成功した場合、このメソッドはレスポンスボディにEventsリソースを返します。

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.Javaクライアントライブラリを使用します

import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventAttendee;
import com.google.api.services.calendar.model.EventDateTime;
import com.google.api.client.util.DateTime;
import java.util.Date;
// ...
// Initialize Calendar service with valid OAuth credentials
Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
    .setApplicationName("applicationName").build();
// Create and initialize a new event (could also retrieve an existing event)
Event event = new Event();
event.setICalUID("originalUID");
Event.Organizer organizer = new Event.Organizer();
organizer.setEmail("organizerEmail");
organizer.setDisplayName("organizerDisplayName");
event.setOrganizer(organizer);
ArrayList<EventAttendee> attendees = new ArrayList<EventAttendee>();
attendees.add(new EventAttendee().setEmail("attendeeEmail"));
// ...
event.setAttendees(attendees);
Date startDate = new Date();
Date endDate = new Date(startDate.getTime() + 3600000);
DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
event.setStart(new EventDateTime().setDateTime(start));
DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
event.setEnd(new EventDateTime().setDateTime(end));
// Import the event into a calendar
Event importedEvent = service.events().calendarImport('primary', event).execute();
System.out.println(importedEvent.getId());

Python

Uses the Python client library.Pythonクライアントライブラリを使用します

event = {
  'summary': 'Appointment',
  'location': 'Somewhere',
  'organizer': {
    'email': 'organizerEmail',
    'displayName': 'organizerDisplayName'
  },
  'start': {
    'dateTime': '2011-06-03T10:00:00.000-07:00'
  },
  'end': {
    'dateTime': '2011-06-03T10:25:00.000-07:00'
  },
  'attendees': [
    {
      'email': 'attendeeEmail',
      'displayName': 'attendeeDisplayName',
    },
    # ...
  ],
  'iCalUID': 'originalUID'
}
imported_event = service.events().import_(calendarId='primary', body=event).execute()
print imported_event['id']

PHP

Uses the PHP client library.PHPクライアントライブラリを使用します

$event = new Google_Service_Calendar_Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime('2011-06-03T10:00:00.000-07:00');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime('2011-06-03T10:25:00.000-07:00');
$event->setEnd($end);
$attendee1 = new Google_Service_Calendar_EventAttendee();
$attendee1->setEmail('attendeeEmail');
// ...
$attendees = array($attendee1,
                   // ...,
                  );
$event->attendees = $attendees;
$organizer = new Google_Service_Calendar_EventOrganizer();
$organizer->setEmail('organizerEmail');
$organizer->setDisplayName('organizerDisplayName');
$event->setOrganizer($organizer);
$event->setICalUID('originalUID');
$importedEvent = $service->events->import('primary', $event);
echo $importedEvent->getId();

Rubyルビー

Uses the Ruby client library.Rubyクライアントライブラリを使用します

event = Google::Apis::CalendarV3::Event.new(
  summary: 'Appointment',
  location: 'Somewhere',
  organizer: {
    email: 'organizerEmail',
    display_name: 'organizerDisplayName'
  },
  start: {
    date_time: '2011-06-03T10:00:00.000-07:00'
  },
  end: {
    date_time: '2011-06-03T10:25:00.000-07:00'
  },
  attendees: [
    {
      email: 'attendeeEmail',
      display_name: 'attendeeDisplayName',
    },
    # ...
  ],
  i_cal_uid: 'originalUID'
)
result = client.import_event('primary', event)
print result.id

Try it!それを試してみてください!

Use the APIs Explorer below to call this method on live data and see the response. 以下のAPI Explorerを使用して、ライブデータに対してこのメ??ソッドを呼び出して応答を確認してください。

関連記事

スポンサーリンク

chia configure 構成を変更する

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る