Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Rest API Integration using Mid Server in ServiceNow

aragarw
Tera Contributor

Hello All,

I want to make a REST API call to third party system using mid server. The proid that runs mid server uses Kerberos authentication and I need to use the same authentication method. However, I don't know what details need to be mentioned in the code for Kerberos authentication by mid server when making the REST API call. Below is the code that I have written but as you can see there is no authentication mentioned in this code, please help me on what details do I need to add in this code for Kerberos authentication method:

 

var requestBody;
var responseBody;
var status;
var sm;
try{
    sm = new sn_ws.RESTMessageV2();  
    sm.setHttpMethod("get");
    sm.setQueryParameter("user","abc");
    sm.setQueryParameter("symbol", "NOW");
    sm.setQueryParameter("action""approve");
    sm.setQueryParameter("eonid","1221");
    sm.setMIDServer('mid server name');
    response = sm.executeAsync(); 

    response.waitForResponse(60);

    responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
    status = response.getStatusCode();
} catch(ex) {
    responseBody = ex.getMessage();
    status = '500';
} finally {
    requestBody = sm ? sm.getRequestBody():null;
}
gs.info("Request Body: " + requestBody);
gs.info("Response: " + responseBody);
gs.info("HTTP Status: " + status);
0 REPLIES 0