admin管理员组文章数量:1391975
Currently running into an issue where when I apply a change to a shared drive, rather than just the shared drive's watch channel getting notified, all 4 channels get notified. Causing 4 webhooks to send on a single change from 1 drive. I've tried doing different combinations of settings restrictToMyDrive
, supportsAllDrives
, includeItemsFromAllDrives
but they don't seem to work. Is it possible to get notified for a change in a shared drive specifically from it's corresponding channel?
Using the /drive/v3/changes/watch
endpoint, I created a webhook on every drive returned from the /drive/v3/drives
endpoint. For each drive I generated a startPageToken from the /drive/v3/changes/startPageToken
endpoint:
{
"driveId": [drive_id],
"supportsAllDrives": "true"
}
and created a watch channel using the POST /drive/v3/changes/watch
endpoint with a request body of:
{
"driveId": [drive_id],
"pageToken": [page_token from startPageToken response],
"includeRemoved": "true"
"restrictToMyDrive": "true"
}
For example, I have 3 shared drives, so I've set 3 watch channels at this point.
At the end of the loop I created another watch channel for the account (to catch all changes as an extra layer of security) to the POST /drive/v3/changes/watch
endpoint with a request body of:
{
"pageToken": [page_token],
"includeRemoved": "true",
"restrictToMyDrive": "false",
"supportsAllDrives": "true",
"includeCorpusRemovals": "true",
"includeItemsFromAllDrives": "true"
}
So in total I have 4 watch channels now.
For a single change in a shared drive, all 4 channels get notified of a change and send 4 webhooks for a single change.
本文标签:
版权声明:本文标题:Google Drive API Webhooks - single change in a shared drive causes notifications on all other drive webhooks - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744699490a2620479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论