AnsweredAssumed Answered

vRO REST call to SMS failing

Question asked by Darek Dowsett on Jan 25, 2019
Latest reply on Jan 29, 2019 by Darek Dowsett

I am attempting to add a host to an SMS using REST calls from VMware vRO. All REST calls work correctly using Postman, but fail with vRO. I created a workflow in vRO that will login into the SMS using REST which responds with the "SID" along with other output. I then "JSON.parse" the output and create a JSON object using the SID. A system.log clearly displays the SID.

 

The workflow continues to the next workflow which should add a host to an existing object-group on SMS. The REST call is the standard vRO script however, I added the following to "add a host":

 

var addHost = "/add-host";
var requestUrl = baseUrl + addHost;
var HostContent = { "name" : "jawa", "ip-address" : "192.168.2.2", "groups" : "Shun List" }
System.log("Request full URL: " + requestUrl);
System.log("sid: " + sid);
var request = transientHost.createRequest(httpMethod, addHost, HostContent);
request.contentType = contentType;
request.setHeader("X-chkp-sid: ", sid);

 

When the workflow runs, I get the SID just fine, parse it to JSON, and attach it to the "X-chkp-sid" header however, it fails:

 

2019-01-24 12:51:49.359] [I] Request full URL: https://192.168.89.151/web_api/add-host
[2019-01-24 12:51:49.360] [I] sid: kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw
[2019-01-24 12:51:49.364] [I] Executing REST request with dynamic credentials: vROadmin
[2019-01-24 12:51:49.365] [I] Query string: /add-host
[2019-01-24 12:51:49.367] [I] Base URL: https://192.168.89.151/web_api
[2019-01-24 12:51:49.487] [I] Content as string: {
"code" : "generic_err_wrong_session_id",
"message" : "Wrong session id [\"kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw\"]. Session may be expired. Please check session id and resend the request."
}

 

The SID is not wrong though. It matches what the /login workflow returned just milliseconds prior. Also, the session on the SMS is still open...vRO did not close it.

 

Any ideas?

Outcomes