I am trying to run the below script to call my api 3 times (looping through the array) and creating a new record using POST method. I can't see in my logs the api call is even been initiated. Can anyone see where I am going wrong?
var tens = "rec1, rec2, re3"
console.log(tens);
var letters = tens.split(',').map(string=>string.trim());
console.log(letters);
async function callAPIs(letters) {
responses = [];
for (let i = 0; i < letters.length; i++) {
var apiRequest = await http.request({
'endpoint': 'test',
'path':'/api/table/records',
'method': 'POST',
"headers": {
"Authorization": "Basic xxxxxxxxx=",
"Content-Type": "application/json"
}
})
apiRequest.send(data)
apiRequest.end((data) => {
responses.push(data)
});
};
return responses
}
var data = {};
var caller_id = "user1";
data.caller_id = caller_id;
console.log(caller_id);