2015-09-23 177 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論壇。