Hi all,

I want to connect the script in the ARIS report with ARIS API repository. I have tenant, name, password and key for creating a token and to start the connection, but in the following code I will not show them(but the fields aren't empty).

I get error that connection is refused on the line "var responseCode = con.getResponseCode();"

Can please someone help?

I have the following piece of code:

function httpRequestPOST(url){

    var obj = new java.net.URL(url);

    var con = obj.openConnection();

    con.setRequestMethod("POST");

    con.setRequestProperty("User-Agent", java.net.USER_AGENT);

    var tenant = "";

    var name = "";

    var password = "";

    var key = "";

    var authString = tenant + ":" + name + ":" + password + ":" + key;

    var encoder = new Base64.encode(authString);    

    con.setRequestProperty("Authorization", "Basic " + encoding);

    var responseCode = con.getResponseCode();

    var iN = new java.io.BufferedReader(new java.io.InputStreamReader(con.getInputStream()));

    var inputLine = new java.lang.String();

    var response = new java.lang.StringBuffer();

    while((inputLine = iN.readLine()) != null){

        response.append(inputLine);

    }

    iN.close();

    return new java.lang.String(response);

    

   try{

        con.getResponseCode();

    }

    catch(e){

        e.getMessage();

    }

}

 or register to reply.

Notify Moderator