google-api - 停止观看 Google Calendar API 中的事件

标签 google-api google-calendar-api

假设我正在使用 channel 观看事件。

停止接收通知的最简单方法是什么?

回调可以只返回404 http状态码吗?

最佳答案

不,错误状态代码不会阻止您接收通知。事实上,错误状态代码将导致更多通知,如 excerpt 中所述。如下:

To indicate success, you can return any of the following status codes: 200, 201, 202, 204, or 102. If your service returns 500, 502, 503, or 504, the Google Calendar API will retry with exponential backoff.

根据他们的API reference ,您需要执行如下所示的 HTTP POST 请求来停止通知。无需 token 。

POST https://www.googleapis.com/calendar/v3/channels/stop
Authorization: Bearer {auth_token_for_current_user}
Content-Type: application/json
{
  "id": "4ba78bf0-6a47-11e2-bcfd-0800200c9a66",
  "resourceId": "ret08u3rv24htgh289g"
}

在不同的SO question ,我在这里询问了resourceId的用途。

关于google-api - 停止观看 Google Calendar API 中的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27866394/

相关文章:

json - 如何在 swift 中创建特定的数据结构。 Swifty Json 没有用 :(

导致 ssl 错误的 PHP 脚本

url - 如何以编程方式检查 Google 用户的个人资料图片是否不是默认图片?

java - 在 Google Calendar API 中处理夏令时

firebase - react-native google api 限制

node.js - 需要打开哪些防火墙和代理设置才能使 Nodejs 的 google calendar api 正常工作?

python - 使用 oauth2 和 Google API 的无法识别的参数

android - 如何在一定时间后停止 requestLocationUpdates()?

node.js - Google OAuth - 授权时无法读取未定义的属性 '0'

laravel - 使用 spatie/laravel-google-calendar 模拟用户