vCO Workflow Script to Add a REST Host with No Credentials

The following script adds a REST Host with No Credentials

var arrAuthenticationParams;
	arrAuthenticationParams = ["Per User Session", "", ""];

var objRESTAuthentication;
	objRESTAuthentication = RESTAuthenticationManager.createAuthentication("Basic", arrAuthenticationParams);

var objRESTHost;
	objRESTHost = new RESTHost(" - No Credentials");
 objRESTHost.url = "";
 objRESTHost.connectionTimeout = 30.0;
 objRESTHost.operationTimeout = 60.0;
 objRESTHost.authentication = objRESTAuthentication;

objRESTHost = RESTHostManager.addHost(objRESTHost);


  1. Sean July 28, 2014 10:44 am  Reply

    Hi, How do you send credentials when performing a rest login with a host configured as ‘Per User Session’ ?

    • Simon Sparks July 28, 2014 10:57 am  Reply

      Hi Sean,

      Firstly you need to visit and enter your username and password and it will generate an encoded string which looks like the following: “admin:$apr1$7/sxCZRJ$obPoohOkLcFKunrKWR9dg.”, I used “admin” and “password”, you only need the 2nd part of the string i.e. the part after the “:”, see below for an example.

      var strBasicAuthentication;
      strBasicAuthentication = “$apr1$7/sxCZRJ$obPoohOkLcFKunrKWR9dg.”;

      var objRESTRequest = objRESTOperation.createRequest([], null);
      objRESTRequest.contentType = “application/json”;
      objRESTRequest.setHeader(“Authorization”, “Basic ” + strBasicAuthentication);


      Simon Sparks

  2. Sean July 28, 2014 4:05 pm  Reply

    Thanks Simon, on the REST-API I am interfacing with it states that the login operation when successful returns an authorisation token in the header of the response but when I do the above in VCO I dont get any headers returned ( allHeaders = response.getAllHeaders() returns no headers ) but if I use a browser based REST client I do get the token returned in the headers. How do I access this token in VCO ?

Leave a Reply