2015-09-23 176 views
0

我正在尝试使用parse rest API执行批量推送通知请求。parse.com是否支持推送通知的批处理操作?

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."}

回答

0

您已经表明卷曲POST。解析推送API不是batch。 Push被发送到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论坛。