[Parse.com] How to Send Push Notifications with REST API

Tadashi Shigeoka ·  Wed, June 26, 2013

Here are curl commands for sending push notifications using Parse.com’s REST API, categorized by use case.

[Reference]: Push Developer Guide | Parse


Send push notification to all apps

curl -X POST \\
  -H "X-Parse-Application-Id: xxxxxxxxxx" \\
  -H "X-Parse-REST-API-Key: xxxxxxxxxx" \\
  -H "Content-Type: application/json" \\
  -d '{
        "data": {
          "alert": "This is a notification message!"
        }
      }' \\
  https://api.parse.com/1/push

Send push notification to Android apps

curl -X POST \\
  -H "X-Parse-Application-Id: xxxxxxxxxx" \\
  -H "X-Parse-REST-API-Key: xxxxxxxxxx" \\
  -H "Content-Type: application/json" \\
  -d '{
        "where": {
          "deviceType": "android",
        },
        "data": {
          "alert": "This is a notification message!"
        }
      }' \\
  https://api.parse.com/1/push

Send push notification to iOS apps [June 26, 2013 at 23:00 (local time)]

curl -X POST \\
  -H "X-Parse-Application-Id: xxxxxxxxxx" \\
  -H "X-Parse-REST-API-Key: xxxxxxxxxx" \\
  -H "Content-Type: application/json" \\
  -d '{
        "where": {
          "deviceType": "ios",
        },
        "push_time": "2013-06-26T23:30:00",
        "data": {
          "alert": "This is a notification message!"
        }
      }' \\
  https://api.parse.com/1/push

Send push notification to iOS apps [June 26, 2013 at 23:00 (local time)] and only to those that have notificationTime set to 23:30 on the app side

curl -X POST \\
  -H "X-Parse-Application-Id: xxxxxxxxxx" \\
  -H "X-Parse-REST-API-Key: xxxxxxxxxx" \\
  -H "Content-Type: application/json" \\
  -d '{
        "where": {
          "deviceType": "ios",
          "notificationTime": "23:30"
        },
        "push_time": "2013-06-26T23:30:00",
        "data": {
          "alert": "This is a notification message!"
        }
      }' \\
  https://api.parse.com/1/push

That’s all from the Gemba.