parse.com是否支持推送通知的批量操作?

时间:2015-09-23 13:40:40

标签: parse-platform

我正在尝试使用parse rest API执行批量推送通知请求。

curl -X POST -H "X-Parse-Application-Id: redacted" -H "X-Parse-REST-API-Key: redacted" -H "Content-Type: application/json" -d '{ "requests": [{ "method": "POST", "path": "/1/push/", "body": { "channels": ["redacted"], "deviceType": "ios", "badge": 1, "data": { "alert": "Hello", "badge": 1, "key": "status" } } }] https://api.parse.com/1/batch

我收到错误:

{"code":107,"error":"Method 'POST' to '/1/push/' not supported in batch operations."}

1 个答案:

答案 0 :(得分:0)

您已在CURL中指示POST。 Parse push api不是batch。推送被发送到Parse中的注册设备(与Apple的证书相关联)以及符合您的推送标准的设备。您的推送消息应该更像是这样:

curl -X POST \
  -H "X-Parse-Application-Id: " \
  -H "X-Parse-REST-API-Key: " \
  -H "Content-Type: application/json" \
  -d '{
        "where": {
          "channels": { 
            "$in": ["channel1","channel2","channel3"]
           },
          "deviceType": "ios"
        },
        "data": {
          "alert": "Alert message here."
        }
      }' \
  https://api.parse.com/1/push 

文档中有各种示例。以上内容来自help论坛。