我尝试使用REST API取消我通过API(使用
我做错了什么,还是OneSignal的服务出了问题?以下是代码:
这是取消请求的响应结果:
include_player_ids
和单个收件人)发送给单个用户的挂起通知,但是我不能在没有传递REST API KEY的情况下执行此操作,这不应该发生,因为在手册中它说在我发送的条件下是不必要的。我做错了什么,还是OneSignal的服务出了问题?以下是代码:
//Creates the notification
$.post(
"https://onesignal.com/api/v1/notifications",
{
"app_id": appId,
"include_player_ids": [userId],
"send_after": later,
"template_id": templateId
},
function(data){
localStorage.ni = data.id;
}
);
//Cancel the notification
var notificationId = localStorage.ni;
$.get("https://onesignal.com/api/v1/notifications/"+notificationId+"?app_id="+appId);
这是取消请求的响应结果:
{
"errors":
[
"Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> with a valid REST API key."
],
"reference":
[
"https://documentation.onesignal.com/docs/accounts-and-keys#section-keys-ids"
]
}