I'm trying to obtain information about a sent notification. But i don't know exactly how to proceed. This is my javascript code:
function obtenerInformacion(uuid){
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.ionic.io/push/notifications/"+uuid);
xhr.setRequestHeader("Access-Control-Allow-Origin","*");
xhr.setRequestHeader("Access-Control-Allow-Methods","GET,PUT,POST,DELETE,OPTIONS");
xhr.setRequestHeader("Access-Control-Allow-Headers","Content-Type");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxN2FlYWZlMC02ZTg4LTQ3NDItOWMxMC04ZTczY2IwNWU4NGMifQ.n25i9yTWdqFauTd6xnfW0Uats_x7EvnB42KhoFu8E04");
xhr.send();
}
I'm getting this error:error
Sorry for my english.
EDIT: Fixed. Apparently the request had to be made by GET
xhr.open("GET", "https://api.ionic.io/push/notifications/"+uuid);
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxN2FlYWZlMC02ZTg4LTQ3NDItOWMxMC04ZTczY2IwNWU4NGMifQ.n25i9yTWdqFauTd6xnfW0Uats_x7EvnB42KhoFu8E04");
xhr.send();
Thank you very much to all