gpt4 book ai didi

post - 尝试注册 Google Drive webhook 时出现 "Required parameter: pageToken"错误

转载 作者:行者123 更新时间:2023-12-01 11:22:00 31 4
gpt4 key购买 nike

遵循指南here ,我正在尝试设置 Google 云端硬盘“推送通知”(网络 Hook ),以便我可以查看所有文件更改。我需要向 https://www.googleapis.com/drive/v3/changes/watch 发送一次性 POST 请求最初“注册” webhook。但我似乎无法成功地做到这一点;使用 curl我收到了 400 Bad Request回复。

这是我通过 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我在哪里得到它?另外,我如何将它包含在请求中(例如作为标题)?指南中没有提到任何内容。

最佳答案

直接来自文档

Changes: watch Subscribes to changes for a user.
Required query parameters
pageToken string

The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.



如果这是第一个请求,那么您将需要使用 getStartPageToken 方法来获取第一个 token ,然后页面 token 将成为响应的一部分。

关于post - 尝试注册 Google Drive webhook 时出现 "Required parameter: pageToken"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41171954/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com