[Parse.com] REST API で Push Notification を送信する方法
- 2013 6/26
Parse.com の REST API でプッシュ通知配信する curl コマンドを用途別にご紹介します。
[参考]: Push Developer Guide | Parse
全てのアプリにプッシュ通知配信
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 |
Android アプリにプッシュ通知配信
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 |
iOS アプリにプッシュ通知配信 [2013年6月26日23時00分(現地時間)]
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 |
iOS アプリにプッシュ通知配信 [2013年6月26日23時00分(現地時間)]
かつ、アプリ側で notificationTime を 23:30 を設定するもののみに、プッシュ通知配信
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 |