Hi im install nodered and openflow by using this Install OpenFlow using NPM on Ubuntu 18 - YouTube video and also i have created nodered with one work flow.then i will hit the api and call the nodered its showing “UNAUTHORIZED” can you please guide me how to call the nodered @Allan_Zimmermann
you are sending a post to the local nodered, was that the intension ? is the “filelistapi” an http node listing on post on /test ? and where is the code below suppose to be from/placed ?
yes @Allan_Zimmermann im sending post api for “/filelistapi” because that api will call my project and then openrpa and workflow will run automatically.
when im hitting this api “http://10.1.1.38:1880/test” the robot will call and run the workflow so thats why im using
when im hit this api “http://10.1.1.38:1880/test” its showing “Unauthorized” can you please guide how can i call the nodered with api
this is my function :
let coreRequest = require("request")
async handler(ctx) {
try {
let fileid = ctx.params.body.fileid;
const formData = {
fileid: fileid,
};
var RequestURL = "http://10.1.1.38:1880/test";
var data = {
url: RequestURL,
method: "POST",
json: formData,
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
};
return new Promise(async (resolve, reject) => {
coreRequest(
data,
async (error, res) => {
try {
if (!error && (res.statusCode == 200 || res.statusCode == 201)) {
let arrdata = res.body.stateJarray;
let fieldtobepopulate = res.body.filedtopopulate;
let chunkData = await this.chunk(arrdata, 1000);
for (let chunkdatas of chunkData) {
for (let data of chunkdatas) {
let id = data._id;
let fieldvalue = data[fieldtobepopulate];
let arrdata1 = {};
arrdata1[fieldtobepopulate] = fieldvalue;
let find =await this.schema.additionals.excelDataModel.find({ _id: mongoose.Types.ObjectId(id)})
let updatedata = await this.schema.additionals.excelDataModel.findOneAndUpdate(
{ _id: mongoose.Types.ObjectId(id)},
{ $set: arrdata1}
)
}
}
resolve({
statusCode: res.statusCode,
headers: res.headers,
data: res.body
});
} else {
console.log("errrrr",error)
reject({ status: false, code: (res && res.statusCode ? res.statusCode : 503), message: error, body: res.body });
}
} catch (error) {
console.log("error",error)
reject({ status: false, code: (res && res.statusCode ? res.statusCode : 503), message: error, body: res.body });
}
}
);
});
} catch (error) {
console.log("errr",error)
}
}```
My workflow :

My nodered Flow:

yes @Allan_Zimmermann im sending post api for “/filelistapi” because that api will call my project and then openrpa and workflow will run automatically.
when im hitting this api “http://10.1.1.38:1880/test ” the robot will call and run the workflow so thats why im using
when im hit this api “http://10.1.1.38:1880/test ” its showing “Unauthorized” can you please guide how can i call the nodered with api
this is my function :
let coreRequest = require("request")
async handler(ctx) {
try {
let fileid = ctx.params.body.fileid;
const formData = {
fileid: fileid,
};
var RequestURL = "http://10.1.1.38:1880/test";
var data = {
url: RequestURL,
method: "POST",
json: formData,
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
};
return new Promise(async (resolve, reject) => {
coreRequest(
data,
async (error, res) => {
try {
if (!error && (res.statusCode == 200 || res.statusCode == 201)) {
let arrdata = res.body.stateJarray;
let fieldtobepopulate = res.body.filedtopopulate;
let chunkData = await this.chunk(arrdata, 1000);
for (let chunkdatas of chunkData) {
for (let data of chunkdatas) {
let id = data._id;
let fieldvalue = data[fieldtobepopulate];
let arrdata1 = {};
arrdata1[fieldtobepopulate] = fieldvalue;
let find =await this.schema.additionals.excelDataModel.find({ _id: mongoose.Types.ObjectId(id)})
let updatedata = await this.schema.additionals.excelDataModel.findOneAndUpdate(
{ _id: mongoose.Types.ObjectId(id)},
{ $set: arrdata1}
)
}
}
resolve({
statusCode: res.statusCode,
headers: res.headers,
data: res.body
});
} else {
console.log("errrrr",error)
reject({ status: false, code: (res && res.statusCode ? res.statusCode : 503), message: error, body: res.body });
}
} catch (error) {
console.log("error",error)
reject({ status: false, code: (res && res.statusCode ? res.statusCode : 503), message: error, body: res.body });
}
}
);
});
} catch (error) {
console.log("errr",error)
}
}```
if you set the api_role environment variable, then you need to authenticate using basic authentication using a user that is a member of that role ( or using a jwt token issued to one of those )