Reputation: 705
i have been parse for a while and it is working fine. Now iam facing a problem on sending push notification. This i have done
curl -X POST \
-H "X-Parse-Application-Id: application id" \
-H "X-Parse-REST-API-Key: REST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channels":[''],
"data": {
"alert": "The Giants won against the Mets 2-3."
}
}' \
https://api.parse.com/1/push
I meant to send a broadcast message. But in parse console it shows
Targeting :
channels includes any of , or nil
deviceType is any of "android", "winphone", or "js"
Sending date :
November 26th, 2013 at 4:32 PM
Expiration :
None
Full target :
{ "channels": { "$in": [ ] }, "deviceType": { "$in": [ "android", "winphone", "js" ] } }
Full data :
{ "alert": "The Giants won against the Mets 2-3." }
Iam not able to figure from where is '$in' key is been assigned for full target? Sending pushes using parse console is working fine.
How it can be solved?
Upvotes: 1
Views: 942
Reputation: 705
It may be silly but it made me nuts for hours. Simply it was the single quotes in channel array causing the problem. Changed to double quotes solved my issue.
Upvotes: 0
Reputation: 4214
Its advanced targeting - REST API always ends up doing that - $in means the channels the push is to be send to... I am not 100% sure but you need to add a where: {} in your call if you want to broadcast to all... Cheers!
Upvotes: 1