Request parameters in a post request in parse.com

后端 未结 1 1898
無奈伤痛
無奈伤痛 2021-01-28 21:37

For a service called mOTP, I need to send a parameter with name \'private\'. Here is my Parse cloud code.

var phnNum = request.params.phnNum;
var validationParam         


        
相关标签:
1条回答
  • 2021-01-28 21:59

    First of all, You should pass a body message with the POST method.

    The content-type should be 'application/x-www-form-urlencoded' according to the documentation.

    Parse.Cloud.httpRequest({
        method: 'POST',
        url: 'https://motp.p.mashape.com/v1/otp/{APIKey}/{SessionId}',
        headers: {
            'X-Mashape-Key': 'YOUR-X-Mashape-Key',
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: {'private': 'Your_mOTP_Private_Key'},
        success: function(httpResponse) {
            response.success(httpResponse.text);
        },
        error: function(httpResponse) {
            response.error("error: " + httpResponse.status);
        }
    });
    
    0 讨论(0)
提交回复
热议问题