监控 Events 资源的更改。
请求
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 | 
| 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 | 通知渠道的存活时间(以秒为单位)。默认值为 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 时间戳表示(以毫秒为单位)。可选。 |