SOLVED
Even if nobody replies, I think that just the act of posting a question here seems to bring about some kind of mystical epiphany.:)
In case anyone should ever need this; to change this to an asynchronous function which runs while your game is still running, it should be something like this:
function apiPostRequest(request, body,runtime) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "POST", baseApiURL + request, true );//TRUE indicates asynchronous
xmlHttp.setRequestHeader('Content-Type', 'application/octet-stream');
xmlHttp.setRequestHeader('X-Auth-token', token);
xmlHttp.onload =function (e)
{
console.log("Resp: "+xmlHttp.responseText);
//alert ("Resp :"+xmlHttp.responseText);
resp=xmlHttp.responseText;
results=JSON.parse(xmlHttp.responseText);
runtime.globalVars.returned_data = xmlHttp.responseText;
runtime.callFunction("Event_Got_Data");//call event sheet function once complete
}
xmlHttp.send(body);
}