var privateKey = 'KEY';
var user_ids = ['116531754956747411721'];
var appId = 'AppId';
// Encode your key
var auth = btoa(privateKey + ':');
// Build the request object
var req = {
method: 'POST',
url: 'https://push.ionic.io/api/v1/push',
headers: {
'Content-Type': 'application/json',
'X-Ionic-Application-Id': appId,
'Authorization': 'basic ' + auth
},
data: {
"user_ids": user_ids,
"notification": {
"alert":"Hello World!"
}
}
};
$http(req).success(function(resp){
console.log("Ionic Push: Push success!");
console.log(JSON.stringify(resp));
}).error(function(error){
// Handle error
console.log(JSON.stringify(error));
console.log("Ionic Push: Push error...");
});
↧
Push Error Code 101
↧