通过 Parse.com 中的 REST API 发送推送通知{“代码":115,“错误":“缺少推送数据."} [英] Send push notification via REST API in Parse.com {"code":115,"error":"Missing the push data."}
问题描述
当我尝试使用 Fiddler 测试 Parse.com 提供的 REST API 时,它返回一个错误.请找到随附的屏幕截图.我可以在 parse.com 上发送推送通知.但不是来自 REST API.
When i am trying to test the REST API provided by Parse.com with Fiddler, it return an error. please find the enclosed screen capture. I can send the push notification on parse.com. but not from REST API.
此处截图:
http://s24.postimg.org/stwspcyir/image.jpg
http://s9.postimg.org/5r3guagh9/image.jpg
=== 跟进 ===找到用于推送通知的 JSON 的正确语法:
=== Follow Up === found the correct syntax of the JSON for push notification:
{"data": { "alert": "test message", "sound": "", "badge": "Increment" },"channel":"abc"}
但我发现如果频道是空的,通知将不起作用,我所要做的就是为设备创建频道......这是真的吗??
but i found that if the channel is empty, the notification will not work, all i have to do is create channels for the device..... is it true ??
推荐答案
终于找到答案了:
如果您有频道,请提供频道名称:
if you have channels, provide the channel name:
{"data": { "alert": "321213", "sound": "", "badge": "Increment" },"channel":"channel name"}
如果没有频道(默认没有频道),发送到所有设备:
if there is no channels (default no channel), send to all devices:
{"data": { "alert": "321213", "sound": "", "badge": "Increment" },"where": { "deviceType": "ios" }}
这篇关于通过 Parse.com 中的 REST API 发送推送通知{“代码":115,“错误":“缺少推送数据."}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!