I would like to get some data from an external rest api. It's a post request. Following are the code which I've tried.
return new Promise(function (resolve) {
var payload = JSON.stringify({ "data": [ "Requirement_Description": "xxx" }], "services": ["xxxx"], "labels": ["label_1"] });
var options = {
'url': 'https://myHost/xxx/api/model/predict',
'method': 'POST',
'body': payload,
'json': true,
'proxy': 'myProxy',
'timeout': 10000,
'followRedirect': true,
'maxRedirects': 10
};
request.post(options, function (error, response, body) {
if (error)
resolve(error.message)
else
resolve(body)
})
});
All the times, I am getting the error UNABLE_TO_VERIFY_LEAF_SIGNATURE. I've seen a question similar to mine, But in my case it's a post request and also passing some sort of raw data to the body while the post operation.