Settings: watch
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
留意設定資源的異動。
要求
HTTP 要求
POST https://www.googleapis.com/calendar/v3/users/me/settings/watch
參數
授權
這項要求需要授權,且至少要有下列其中一個範圍:
範圍 |
https://www.googleapis.com/auth/calendar.readonly |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.settings.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 |
通知管道的存留時間 (以秒為單位)。預設值為 604800 秒。 |
|
回應
如果成功的話,這個方法會傳回回應內文,其結構如下:
{
"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 時間戳記表示,以毫秒為單位。選填。 |
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Settings: watch\n\n| **Note:** Requires [authorization](#auth).\n\nWatch for changes to Settings resources.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/calendar/v3/users/me/settings/watch\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|-------|-------------|\n\n### Authorization\n\nThis request requires 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.settings.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. | |"]]