我试图使用Node.js调用API,但出现错误。不确定是Node.js错误还是API错误或我在做什么错。
响应:{“ message”:“ loginModel不能为空”,“ errorCode”:0,“ resourceIds”:null}
涉及多个因素,我在AWS lambda中使用Node.js来调用UiPath(RPA)API。
var http = require('https');
exports.handler =函数(事件,上下文){
var req = http.request({
host: "platform.uipath.com",
port: 443,
path: "/api/account/authenticate",
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
data: {
"tenancyName": "tenantName",
"usernameOrEmailAddress": "emailId",
"password": "password"
}
}, function (response) {
response.on('data', function(data) {
console.log('Response: ' + data);
});
});
req.setTimeout(5000, function() {
console.log('Request timed out.');
});
req.on('error', function(ex){
console.log('Request was a failure. ' + ex.message);
});
req.write('');
req.end();
};
我希望得到类似的回复
{ “ result”:“ xxxTokenxxx”, “ targetUrl”:null, “成功”:是的, “错误”:null, “ unAuthorizedRequest”:否, “ __abp”:是 }