0
POSTを使用してGCM
通知に電話しています。 私が使用していたコードは次のとおりです。ノードJSON_PARSING_ERRORを取得する
var jsonbody={"to": "/topics/global",
"data": {
"title": "TestTitle",
"is_background": false,
"message": "Testmessage",
"image": "",
"payload": {
"team": "India",
"score": "5.6" },
"timestamp": "2016-12-13 16:32:05"
}
};
var request = require('request');
request.post({
headers: {'content-type': 'application/json',
Authorization:'key=(my key)'},
url: 'https://fcm.googleapis.com/fcm/send',
BODY: jsonbody
}, function (error, response, body) {
if (error) {
console.log('failure ' + error);
} else {
console.log('success '+response + 'and ' +body);
}
});
として、私はエラーを取得しています:私は実際に何かが欠けた
success [object Object]and JSON_PARSING_ERROR: Unexpected token END OF FILE at position 0.