Send push notification via REST API in Parse.com {

2019-04-11 20:48发布

问题:

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.

Screenshot here:
http://s24.postimg.org/stwspcyir/image.jpg
http://s9.postimg.org/5r3guagh9/image.jpg

=== 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 ??

回答1:

Found the answer finally:

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" }}