停止 Google 推送通知,响应 "channel not found for project"
Stop Google push notification, response "channel not found for project"
我正在使用 Google 日历推送通知。一切正常,我注册我的频道没有问题。对日历的更改会按预期产生通知。
我想停止推送通知。我正在呼叫 Google 停止推送通知 API。
“https://www.googleapis.com/calendar/v3/channels/stop”
但我收到错误代码:404 and message: "Channel not found for project"
.
要求:
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) })
回复:
{ [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\'' } ] }
谁能帮我解决这个错误?
谢谢。
我无法确认您是否在使用库,但您似乎正在调用 calendarList watch method and not the channel stop 方法(用于停止推送通知)。
根据日历 API 文档中的 Push Notification 页面,必填字段确实是 channelID 和 resourceID(如您指定的那样;还需要用户的身份验证令牌)
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"
}
我正在使用 Google 日历推送通知。一切正常,我注册我的频道没有问题。对日历的更改会按预期产生通知。
我想停止推送通知。我正在呼叫 Google 停止推送通知 API。
“https://www.googleapis.com/calendar/v3/channels/stop”
但我收到错误代码:404 and message: "Channel not found for project"
.
要求:
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) })
回复:
{ [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\'' } ] }
谁能帮我解决这个错误? 谢谢。
我无法确认您是否在使用库,但您似乎正在调用 calendarList watch method and not the channel stop 方法(用于停止推送通知)。
根据日历 API 文档中的 Push Notification 页面,必填字段确实是 channelID 和 resourceID(如您指定的那样;还需要用户的身份验证令牌)
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"
}