Reputation: 101
I am using Google Calendar Push Notifications. All is working well and I register my channel with no issue. Changes to the calendar result in a notification as expected.
I want to stop the push notification. I am calling Google stop push notification API.
"https://www.googleapis.com/calendar/v3/channels/stop"
But I am getting Error code: 404 and message: "Channel not found for project"
.
Request:
googleCalendar.channels.stop({
auth: oauth2Client,
resource: {
id: 'cfabcfaa-a6eb-4432-8068-6417ee2ce8a6', //channelID
resourceId: '3kGwQdmzSMCZ41MAFdwEzt0ugNQ' //resourceID
}
}, function(err, results) {
if(err){
return;
}
console.log(results) })
Response:
{ [Error: Channel 'cfabcfaa-a6eb-4432-8068-6417ee2ce8a6' not found for project '87165627894']
code: 404,
errors:
[ { domain: 'global',
reason: 'notFound',
message: 'Channel \'cfabcfaa-a6eb-4432-8068-6417ee2ce8a6\' not found for project \'87165627894\'' } ] }
Can anyone help me why I am getting this error? Thanks.
Upvotes: 2
Views: 2633
Reputation: 2998
I can't confirm if you're using a library, but it seems that you're calling the calendarList watch method and not the channel stop method (which is used to stop push notification).
Based on the Push Notification page in the Calendar API documentation, the required fields are indeed channelID and resourceID (as what you've specified; also required is the auth token of the user)
https://www.googleapis.com/calendar/v3/channels/stop
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"
}
Upvotes: 1