2016-03-22 2 views
1

pushwooshリモートAPIを使用して、パーズサーバー(クラウドコード)からプッシュ通知を送信します。私は彼らのGuidelines Hereに従うことを試みているが、私の要求文字列が不正であることを意味する要求のために400エラーコードが返ってくる。パーズクラウドコードからPushwooshリモートAPIを呼び出す

400 | N/A |不正な形式のリクエスト文字列のすべての(status codes hereから)

Parse.Cloud.afterSave("LinkPost", function(request, response) { 


Parse.Cloud.httpRequest({ 
     method: 'POST', 
     url: 'https://cp.pushwoosh.com/json/1.3/createMessage', 
     data: JSON.stringify({ 
        "request": { 
        "application": "APPLICATION_ID", 
        "auth": "AUTH_TOKEN", 
        "notifications": [{ 
         "send_date": "now", 
         "ignore_user_timezone": true, 
         "content": "Hello world!" 
             }] 
           } 
          }), 
     dataType: 'json' 


}).then(function(httpResponse) { 
      console.log(httpResponse.text); 
      }, function(httpResponse) { 
      console.error('Request failed with response code ' + httpResponse.status); 
      }); 

}); 

答えて

0

まず、決しては公共の場であなたのトークン認証やアプリケーションIDを投稿してください。投稿を編集して、アプリケーションIDと認証トークンを削除することを強くお勧めします。問題の今

:pushwoosh $ AJAXポストコール

Parse.Cloud.afterSave("LinkPost", function(request, response) { 
    Parse.Cloud.httpRequest({ 
     method: 'POST', 
     url: 'https://cp.pushwoosh.com/json/1.3/createMessage', 
     body: JSON.stringify({ 
      "request": { 
       "application": "APPLICATION_ID", 
       "auth": "AUTH_KEY", 
       "notifications": [{ 
        "send_date": "now", 
        "ignore_user_timezone": true, 
        "content": "Hello world!" 
       }] 
      } 
     }), 
     dataType: 'json' 
    }).then(function(httpResponse) { 
    console.log(httpResponse.text); 
    }, function(httpResponse) { 
     console.error('Request failed with response code ' + httpResponse.status); 
    }); 
}); 
によって導かれるよう

Parse.Cloud.httpRequestではなく、 "データ" のパラメータとして "身体" を取ります

関連する問題