I would like to create html / javascript form on my website. With the form I want to send a push notice to Wired Android and iOS devices.
Login http request works fine:
httpRequest.open ('POST', 'https: //api.cloud.appcelerator.com/v1/users/ Login .json key = xxxAPKEYxxx & amp; login = xxxEMAILxxx & password = xxxPASSWORDxxx '); HttpRequest.send (); HttpRequest.onload = function () {var data = JSON.parse (this.responseText); Var sessionID = data.meta.session_id; SendPush (); } ":" "Meta": {"code": 200, "status": "right", "method_name": "login user" .... so entry is success . But then when I call the sendPush function, I get a response error: Feedback error: "Status": "Failed", "Code": 400, "Message": "Failed to authenticate user". function sendPush () {httpRequest.open ('POST', 'https: //api.cloud.appcelerator.com/v1/push_notification/notify.json?key = xxxAPPKEYxxx and channel = XxxCHANNELxxx & payload = test '); HttpRequest.send (); HttpRequest.onload = function () {console.log (this.responseText); }; }
function sendPush () {var BASEURL = 'https: // Api.cloud.appcelerator.com/v1/ 'httpRequest.open (' Post ', BASEURL +' push_notification / notify.json? Key = APPKE '); HttpRequest.send ({channel: "xxxCHANNELxxx", payload: "test"}); HttpRequest.onload = function () {console.log (this.responseText); }; }
No comments:
Post a Comment