2014-02-16 32 views
0

我能推送通知發送到訂閱頻道的移動客戶端(讓我們使用解析REST API說channel_1channel_2通過發佈JSON到https://api.parse.com/1/push發送推送給沒有使用Parse訂閱頻道的人?

{ 
    "channels": ["channel_1", "channel2"], 
    "data": { "alert": "Test" } 
} 

不過,我想送通知誰訂閱channel_1channel_2但人們也訂閱另一個特定通道(channel_3)。

有沒有辦法做到這一點與解析REST API?我知道我能做到這一點通過解析的管理面板

回答

0

我貼我的解析論壇someone from Parse responded問題,:

在這種情況下,你需要使用先進瞄準。基本上,在安裝類上構建一個查詢,該類針對的是訂閱了這兩個通道的對象,而沒有「通道」鍵中的第三個。

curl -X POST \ 
    -H "X-Parse-Application-Id: YOUR_APP_ID" \ 
    -H "X-Parse-REST-API-Key: YOUR_REST_API_KEY" \ 
    -H "Content-Type: application/json" \ 
    -d '{ 
     "where": { 
      "channels": {"$all": ["channel_1", "channel_2"], "$nin": ["channel_3"]} 
     }, 
     "data": { 
      "alert": "Hello world!" 
     } 
     }' \ 
    https://api.parse.com/1/push 
相關問題