1
我嘗試使用https://mobile.ng.bluemix.net/imfpush/v1/apps/ {APPID} /設備/ {設備ID}推動本網站通知:https://mobile.ng.bluemix.net/imfpush/#/,但我有一個錯誤消息IBM推送通知:無效的Json
體:
{ "alert" : "You have a request for payment."}
錯誤消息:
400 {
"code": "FPWSE0004E",
"message": "Bad Request - Invalid JSON."
}
,並嘗試通過調用HTTPS使用上要求的NodeJS
在我的代碼:由郵遞員
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();
和呼叫API,我得到一個錯誤信息:不能得到任何迴應。 請給我你的想法。
什麼是「標題」? – yuxhuang
@yuxhuang:我只是添加它,請幫助審查 –