I try to using the https://mobile.ng.bluemix.net/imfpush/v1/apps/{appID}/devices/{deviceID} to push notification on this site: https://mobile.ng.bluemix.net/imfpush/#/, but I have a error message
body:
{ "alert" : "You have a request for payment."}
error message:
400 {
"code": "FPWSE0004E",
"message": "Bad Request - Invalid JSON."
}
and try to using by calling https request on nodejs
In my code:
var message = {
alert : "You have a request for payment.",
url : "payment_id"
};
var headers = {
'Content-Type' : 'application/json',
'appSecret': 'xxxxxx',
"clientSecret": "xxxxxxxx"
'Content-Length' : Buffer.byteLength(message, 'utf8')
};
var options = {
host : 'mobile.ng.bluemix.net',
port : 443,
path : '/imfpush/v1/apps/'+appId +'/devices/'+deviceId,
method : 'PUT',
headers : headers,
data: JSON.stringify(message)
};
var reqPost = https.request(options, function(res) {
res.on('data', function(d) {
console.info('PUT result:\n');
process.stdout.write(d);
console.info('\n\PUTcompleted');
});
});
reqPost.end();
and call API by postman, I get an error message: cannot get any response. Please give me your thoughts.
headers
? – yuxhuang