Wednesday, September 16, 2020

ServiceNow and Zscaler Integration using REST Message

 REST API to Integration Zscaler and ServiceNow


var vZScalerAPIKEY = "<Api Key>";
//****** Get time in miliseconds**************************//
var vDate = new Date();
var vTimestamp = vDate.getTime().toString();
var vHigh = vTimestamp.substring(vTimestamp.length - 6);
var vLow = (parseInt(vHigh) >> 1).toString();
var vApiKey = "";
while (vLow.length < 6) {
low = "0" + vLow;
}
for (var i = 0; i < vHigh.length; i++) {
vApiKey += vZScalerAPIKEY.charAt(parseInt(vHigh.charAt(i)));
}
for (var j = 0; j < vHigh.length; j++) {
vApiKey += vZScalerAPIKEY.charAt(parseInt(vLow.charAt(j)) + 2);
}


//************************Authentication to Zscaler *****************//
var vSessionId ='';
var user = "<UserName>";
var password = "<Password>";


var vAuthbody = '{"username":"'+user+'","password":"'+password+'","apiKey":"'+vApiKey+'","timestamp":"'+vTimestamp+'"}';
var  vAuthentication= new sn_ws.RESTMessageV2();
vAuthentication.setEndpoint("<End Point>");
vAuthentication.setRequestHeader("cache-control","no-cache");
vAuthentication.setRequestHeader('content-type','application/json');
vAuthentication.setHttpMethod("post");
vAuthentication.setRequestBody(vAuthbody);
var vAuthResponse = vAuthentication.execute();
var vAuthResponseBody = vAuthResponse.getBody();
var vAuthHttpStatus = vAuthResponse.getStatusCode();
var cookies = vAuthResponse.getCookies();
var i;
for(i=0;i<1;i++) {
var vJID =  (cookies.get(i)).split(';');
vSessionId  = vJID[0];
}

gs.print(vSessionId);
gs.print(vAuthResponseBody);
gs.print(vBlockurlHttpStatus );

1 comment:

  1. Thereafter, every player has complete freedom to 카지노사이트 play that hand simply greatest way|the means in which} they need. When the dealing is complete, all players are concurrently offered the opportunity to Hit, Double Down or Split. The player who makes the fastest determination will get their subsequent card dealt first. Speed Blackjack is our fastest Blackjack yet and the most recent addition to our Speed household of games!

    ReplyDelete