Since Yesterday morning I'm stuck with a google drive API request.
As explained here : https://developers.google.com/drive/api/v3/push
I'm trying to subscribe to notifications sending this request :
Url : https://www.googleapis.com/drive/v3/changes/watch
Header :
Content-type: application/json
Authorization: Bearer my_auth_token
{
"id":"An ID generated",
"type":"web_hook",
"address":"my callback address",
}
The response is a code 400 with this body :
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: pageToken",
"locationType": "parameter",
"location": "pageToken"
}
],
"code": 400,
"message": "Required parameter: pageToken"
}
}
This parameter isn't required according for this subscription request but for this one (same url..) : https://developers.google.com/drive/api/v3/reference/changes/watch
Am I missing / misunderstanding something or is there a problem with the documentation ?
Thank you
The pageToken parameter is 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, as we see here.
Therefore, you should pass the pageToken as a parameter to your URL:
Url: https://www.googleapis.com/drive/v3/changes/watch?pageToken=[YOUR_PAGE_TOKEN_NUMBER_HERE]
for example: https://www.googleapis.com/drive/v3/changes/watch?pageToken=101
It might be interesting to use GET https://www.googleapis.com/drive/v3/changes/startPageToken to gets the starting pageToken for listing and watch future changes. See here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With