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です。許容値は0 to 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 |
|
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 Required when adding an attachment.Google Driveの添付ファイルを追加するには、Drive APIのリソースの 添付ファイルを追加するときに必要です。 |
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:
|
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.出席者がイベントの表現から省略された可能性があるかどうか。イベントを取得するとき、これはmaxAttendee queryパラメータで指定された制限が原因である可能性があります。イベントを更新するとき、これは参加者の応答を更新するためだけに使用できます。オプションです。デフォルトは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 フィールドを使用します。変更を保持するには、すべてのイベント変更要求に対してconferenceDataVersion requestパラメータをに設定することを忘れないでください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:
|
writable 書き込み可能 |
gadget.height |
integer |
The gadget's height in pixels. The height must be an integer greater than 0. Optional.ガジェットの高さ(ピクセル単位)。高さは0より大きい整数でなければなりません。 | writable 書き込み可能 |
gadget.iconLink |
string |
The gadget's icon URL. The URL scheme must be HTTPS.ガジェットのアイコンのURL。URLスキームはHTTPSにする必要があります。 | writable 書き込み可能 |
gadget.link |
string |
The gadget's URL. The URL scheme must be HTTPS.ガジェットのURL。URLスキームはHTTPSにする必要があります。 | 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に設定されattendees たorganizer フィールドを持つ別のエントリで示されます。開催者を変更するには、移動操作を使用します。イベントをインポートする場合を除き、読み取り専用です。 |
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行はこのフィールドには使用できないことに注意してください。イベントの開始時間と終了時間はstart and 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:
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:
|
writable 書き込み可能 |
summary |
string |
Title of the event.イベントのタイトル | writable 書き込み可能 |
transparency |
string |
Whether the event blocks time on the calendar. Optional. Possible values are:
|
writable 書き込み可能 |
visibility |
string |
Visibility of the event. Optional. Possible values are:
|
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を使用して、ライブデータに対してこのメ??ソッドを呼び出して応答を確認してください。
関連記事
- Events: watch
- Events: update
- Events: quickAdd
- Events: patch
- Events: move
- Events: list
- Events: instances
- Events: insert
- Events: get
- Events: delete
スポンサーリンク