Events: watch

留意事件资源的变化。

请求

HTTP 请求

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

参数

参数名称 说明
路径参数
calendarId string 日历标识符。要检索日历 ID,请调用 calendarList.list 方法。如果您想访问当前登录的用户的主日历,请使用“primary”关键字。
可选的查询参数
eventTypes string 系统会为监视方法忽略事件类型。

授权

此请求至少授予以下其中一个范围的授权:

范围
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

如需了解详情,请参阅身份验证和授权页面。

请求正文

在请求正文中,请按以下结构提供数据:

{
  "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 受监控资源的版本专用标识符。
token string 通过目标渠道传递到相应地址的任意字符串。可选。
expiration long 通知渠道到期的日期和时间,以 Unix 时间戳表示,以毫秒为单位。可选。