Events: watch
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Events リソースの変更を監視します。
リクエスト
HTTP リクエスト
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch
パラメータ
パラメータ名 |
値 |
説明 |
パスパラメータ |
calendarId |
string |
カレンダー ID。カレンダー ID を取得するには、calendarList.list メソッドを呼び出します。現在ログインしているユーザーのメイン カレンダーにアクセスするには、「primary 」キーワードを使用します。
|
省略可能なクエリ パラメータ |
eventTypes |
string |
監視するリソースのイベントタイプ。省略可。このパラメータを複数回繰り返して、さまざまなタイプのリソースを監視できます。未設定の場合、すべてのイベントタイプが返されます。
有効な値は次のとおりです。
- 「
birthday 」: 年間に 1 回繰り返される特別な終日の予定。
- 「
default 」: 定期イベント。
- 「
focusTime 」: サイレント モードの予定。
- 「
fromGmail 」: Gmail からの予定。
- 「
outOfOffice 」: 不在の予定。
- 「
workingLocation 」: 勤務場所のイベント。
|
承認
このリクエストでは、少なくとも次のうち 1 つのスコープによる承認が可能です。
範囲 |
https://www.googleapis.com/auth/calendar.readonly |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.events.readonly |
https://www.googleapis.com/auth/calendar.events |
https://www.googleapis.com/auth/calendar.app.created |
https://www.googleapis.com/auth/calendar.events.freebusy |
https://www.googleapis.com/auth/calendar.events.owned |
https://www.googleapis.com/auth/calendar.events.owned.readonly |
https://www.googleapis.com/auth/calendar.events.public.readonly |
詳しくは、認証と認可のページをご覧ください。
リクエストの本文
リクエストの本文には、以下の構造を使用してデータを指定してください。
{
"id": string,
"token": string,
"type": string,
"address": string,
"params": {
"ttl": string
}
}
プロパティ名 |
値 |
説明 |
メモ |
id |
string |
このチャンネルを識別する UUID または一意の文字列。 |
|
token |
string |
このチャンネル経由で通知と一緒に対象のアドレスに配布される任意の文字列。省略可。 |
|
type |
string |
このチャンネルで使用される配信方法の種類。有効な値は「web_hook 」(または「webhook 」)です。どちらの値も、Http リクエストを使用してメッセージが配信されるチャネルを指します。 |
|
address |
string |
このチャンネルの通知が配信されるアドレス。 |
|
params |
object |
配信チャンネルの操作を制御する追加のパラメータ。省略可。 |
|
params.ttl |
string |
通知チャネルの有効期間(秒単位)。デフォルトは 604,800 秒です。 |
|
レスポンス
成功すると、このメソッドは次の構造を含むレスポンスの本文を返します。
{
"kind": "api#channel",
"id": string,
"resourceId": string,
"resourceUri": string,
"token": string,
"expiration": long
}
プロパティ名 |
値 |
説明 |
メモ |
kind |
string |
リソースの変更を監視するために使用される通知チャンネルとして識別します(「api#channel 」)。 |
|
id |
string |
このチャンネルを識別する UUID または一意の文字列。 |
|
resourceId |
string |
このチャンネルで監視するリソースを識別する不透明な ID。異なる API バージョンでも安定しています。 |
|
resourceUri |
string |
監視対象のリソースのバージョン固有の ID。 |
|
token |
string |
このチャンネル経由で通知と一緒に対象のアドレスに配布される任意の文字列。省略可能。 |
|
expiration |
long |
通知チャンネルの有効期限。Unix のタイムスタンプでミリ秒単位で表示されます。省略可。 |
|
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[],[],null,["# Events: watch\n\n| **Note:** [Authorization](#auth) optional.\n\nWatch for changes to Events resources.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `calendarId` | `string` | Calendar identifier. To retrieve calendar IDs call the [calendarList.list](/workspace/calendar/api/v3/reference/calendarList/list) method. If you want to access the primary calendar of the currently logged in user, use the \"`primary`\" keyword. |\n| **Optional query parameters** |||\n| `eventTypes` | `string` | Event types of resources to watch. Optional. This parameter can be repeated multiple times to watch resources of different types. If unset, returns all event types. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`birthday`\": Special all-day events with an annual recurrence. - \"`default`\": Regular events. - \"`focusTime`\": Focus time events. - \"`fromGmail`\": Events from Gmail. - \"`outOfOffice`\": Out of office events. - \"`workingLocation`\": Working location events. |\n\n### Authorization\n\nThis request allows authorization with at least one of the following scopes:\n\n| Scope |\n|-------------------------------------------------------------------|\n| `https://www.googleapis.com/auth/calendar.readonly` |\n| `https://www.googleapis.com/auth/calendar` |\n| `https://www.googleapis.com/auth/calendar.events.readonly` |\n| `https://www.googleapis.com/auth/calendar.events` |\n| `https://www.googleapis.com/auth/calendar.app.created` |\n| `https://www.googleapis.com/auth/calendar.events.freebusy` |\n| `https://www.googleapis.com/auth/calendar.events.owned` |\n| `https://www.googleapis.com/auth/calendar.events.owned.readonly` |\n| `https://www.googleapis.com/auth/calendar.events.public.readonly` |\n\nFor more information, see the [authentication and authorization](/workspace/guides/configure-oauth-consent) page.\n\n### Request body\n\nIn the request body, supply data with the following structure:\n\n```carbon\n{\n \"id\": string,\n \"token\": string,\n \"type\": string,\n \"address\": string,\n \"params\": {\n \"ttl\": string\n }\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|\n| `id` | `string` | A UUID or similar unique string that identifies this channel. | |\n| `token` | `string` | An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. | |\n| `type` | `string` | The type of delivery mechanism used for this channel. Valid values are \"`web_hook`\" (or \"`webhook`\"). Both values refer to a channel where Http requests are used to deliver messages. | |\n| `address` | `string` | The address where notifications are delivered for this channel. | |\n| `params` | `object` | Additional parameters controlling delivery channel behavior. Optional. | |\n| params.`ttl` | `string` | The time-to-live in seconds for the notification channel. Default is 604800 seconds. | |\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```text\n{\n \"kind\": \"api#channel\",\n \"id\": string,\n \"resourceId\": string,\n \"resourceUri\": string,\n \"token\": string,\n \"expiration\": long\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|----------|-------------------------------------------------------------------------------------------------------------------|-------|\n| `kind` | `string` | Identifies this as a notification channel used to watch for changes to a resource, which is \"`api#channel`\". | |\n| `id` | `string` | A UUID or similar unique string that identifies this channel. | |\n| `resourceId` | `string` | An opaque ID that identifies the resource being watched on this channel. Stable across different API versions. | |\n| `resourceUri` | `string` | A version-specific identifier for the watched resource. | |\n| `token` | `string` | An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. | |\n| `expiration` | `long` | Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional. | |"]]