Ionic Push is no longer working 1.x

86 Views Asked by At

Everything has been working great then now I get the following error:

ionic.bundle.js:18463 OPTIONS https://push.ionic.io/api/v1/push net::ERR_NAME_NOT_RESOLVED

i cant seem to send a push using the following:

// 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: {
        "tokens": devices,
        "notification": {
          "alert": message,
          "ios":{
            "priority": 10,
            "badge": 1,
            "payload": {"path": path}
          }
        }
    }
};

// Make the API call
$http(req).success(function(resp){
  // Handle success
  console.log("Ionic Push: Push success!");
}).error(function(error){
  // Handle error 
  console.log("Ionic Push: Push error...");
});

everything just stopped working - it was working beautifully before.

thanks for your help

1

There are 1 best solutions below

0
On

I think they have change the URL and format little bit.

New URL is https://api.ionic.io/push/notifications

Payload

{ "tokens":["device_token_1", "device_token_2"], "profile": "prod", "notification": { "title" : "Title of the message", "message": "Ur message!" } }