假设我正在使用 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/