Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse Rest API - Push Notification With Advanced Targeting Error

I have asked this question on Parse's forum but received no replies in 14 hours, so I am falling back on what was my first choice anyway, good ol SO.

I am testing sending push notifications using a query. I am pretty sure that I am using the correct installation id in the query. But the push is not getting sent to my device. Maybe there is something wrong with the syntax?

curl -X POST \
  -H "X-Parse-Application-Id: xxx" \
  -H "X-Parse-REST-API-Key: yyy" \
  -H "Content-Type: application/json" \
  -d '{"where":{"id":{"in":["8e40a0b9-edef-442b-ad1a-3b5eb8c7fd8b"]}},"data":{"alert":"d"}}'\
  https://api.parse.com/1/push

Which gives the response:

{"result":true}

But the notification is not sent. On Parse's dashboard I see following: enter image description here

enter image description here

Anyone here with experience with Parse API, know what might be wrong with my query or request? Also, if anyone has an opinion on this let me know: Do you see any potential problem with using the in query as done above if there are say 100s of installation ids that need to be notified?

like image 294
septerr Avatar asked Jan 29 '26 11:01

septerr


1 Answers

Found the solution. Two things were wrong with my query: First I was using in instead of $in. Second, my constraint was on id, it needed to be installationId. Following worked:

curl -X POST \
  -H "X-Parse-Application-Id: xxx" \
  -H "X-Parse-REST-API-Key: yyy" \
  -H "Content-Type: application/json" \
  -d '{"where":{"installationId":{"$in":["8e40a0b9-edef-442b-ad1a-3b5eb8c7fd8b"]}},"data":{"alert":"d"}}'\
  https://api.parse.com/1/push
like image 166
septerr Avatar answered Jan 31 '26 06:01

septerr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!