按照指南here,我试图设置Google云端硬盘“推送通知”(webhooks),以便我可以观察所有文件更改。我需要发送一次性POST请求到https://www.googleapis.com/drive/v3/changes/watch
以初始“注册”webhook。但我似乎无法成功地做到这一点;使用curl
我收到400 Bad Request
响应。尝试注册Google Drive webhook时出现“必需参数:pageToken”错误
这里是通过curl
我的HTTP请求:
curl 'https://www.googleapis.com/drive/v3/changes/watch' \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer access_token' \
--data-binary '{"id": "webhook", "type": "web_hook", "address": "https://example.com/webhooks", "token": "example"}' \
-vvvv
响应:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: pageToken",
"locationType": "parameter",
"location": "pageToken"
}
],
"code": 400,
"message": "Required parameter: pageToken"
}
}
什么是pageToken
,从哪儿可以得到它?另外,如何将它包含在请求中(例如作为标题)?关于它在指南中没有提及。
谢谢!奇怪的是,这在指南中没有提到。为什么我需要一个'pageToken'来创建一个webhook?我认为这只是用于返回分页数据的[list](https://developers.google.com/drive/v3/reference/changes/list)端点...?非常奇怪和不直观。 –
我也想知道为什么需要pageToken? – Silko