I have node js service code it take single task number to update url, i have modified the code for multiple task number to update,in single api call i need to update multiple task number but its not happening in below code.
const updateRFC = async (request, response) => {
const { CONTENT_TYPE, ITSM_CONST } = constants;
const { APIGEE_HOST } = ITSM_CONST;
const correlationId = request.headers['x-correlation-id'];
logger.trace('operations-util :: itsm-tool :: changes :: standardChangeRequest :: createStandardRFC :: Method Entry', correlationId);
const jasonBody = request.body.metaInformation.ctaskdetails;
console.log("sowmya", jasonBody);
const rfcOptions = () => jasonBody.map(async (task) => {
// request.body.metaInformation.ctaskdetails = envt;
// console.log("envt",envt);
// const body = JSON.stringify(request.body.metaInformation.ctaskdetails);
// console.log("bodyjson", body);
const host = CONFIG.application.EPAAS_ENV.toLowerCase().includes('e3') ? CONFIG.application.url['apigee-api-request-host'] : APIGEE_HOST;
const path = '/management/operations/v2/itsm/change_mgmt/changes/tasks/state';
const port = CONFIG.application.url['apigee-api-request-port'];
const method = 'PUT';
const hmacOptions = {
clientKey: '3X5rSYRriKbCi1QB19nWXATGS7OubZE5',
clientSecret: 'TWQpORIA3wTwVBbsEbVkxsIatKh2Snhu',
host,
path,
method,
port,
};
const hmacAuthToken = hmacAuth.generateAuthHeader(hmacOptions, JSON.stringify(task), correlationId);
const options = {
host,
path,
method,
headers: {
correlation_id: correlationId,
'content-type': CONTENT_TYPE,
'X-AMEX-API-KEY': hmacOptions.clientKey,
Authorization: hmacAuthToken,
service_id: CONFIG.application.VAULT.ITSM_SRE_API_SERVICE_ID,
},
};
console.log("sowmya1", options);
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
const result = await PromiseUtil.post(options, JSON.stringify(task));
console.log("result", result);
return result;
});
// const multiServiceEDCResult = await Promise.allSettled(rfcOptions())
// console.log("multiServiceEDCResult", multiServiceEDCResult);
await Promise.allSettled(rfcOptions())
.then((result) => {
response.status(200).send(result);
console.log("resultresp",result);
}).catch((error) => {
logger.warn(`operations-util :: itsm-tool :: changes :: standardChangeRequest :: createStandardRFC :: ${error.toString()}`, correlationId);
response.status(500).send({ status: 500, message: error.toString() });
logger.trace('operations-util :: canary-control :: manage :: globalTrafficFetch :: Method Exit', correlationId);
});
};
I have node js service code it take single task number to update url, i have modified the code for multiple task number to update,in single api call i need to update multiple task number but its not happening in below code.
I am expecting to update multiple taskNumber using single api call.
Sowmya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.