Need to do validation in a parameterized fixlets using a REST call

I want to check the validity of input parameters by doing a REST call to the service. I need to check if the credentials are correct and can be used before action is deployed.

Currently I am trying to use XMLHttpRequest for REST calls in the CustomValidator function. But I am getting the given error.

Is there a way I can do a rest call from fixlet before deploying it?

example code for my validator:

validateConn : function (validationObj) {
    var currentValue = validationObj["currentValue"];
    var mykey = FixletUtils.getElementValue("mykey");
    var xmlhttp;
    var myheader = "myKey=" + mykey + "; secret=" + currentValue;
    xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
         if (xmlhttp.readyState == 4 && xmlhttp.status != 200) {
            return "Nope";
        }
    };
    xmlhttp.open("GET", "...", false);
    xmlhttp.setRequestHeader("myheader", myheader);
    xmlhttp.send(null);
}

so you want to test if a restapi call to the bigfix rest api will succeed to make sure the creds are correct before deploying the fixlet?

I’m not certain that would work.

I actually want to do a rest api call to my service which will be used in the task action. I want to make sure that the reds are correct before any action is taken. Would there be any other way to do this?