vRA 8 - GET tenant Details

 Inputs:-

 orgId(string)

vraHost(vra:HOST)

var url = "/csp/gateway/am/api/orgs/";
var restClient = vraHost.createRestClient();
var request = restClient.createRequest("GET", url + orgId);
request.setHeader("Content-Type", "application/json")
var response = restClient.execute(request);
statusCodeAttribute = response.statusCode;
System.log("REST Response Status Code: " + statusCodeAttribute);
if (statusCodeAttribute == 200 || statusCodeAttribute == 201){
responseAsString = response.contentAsString;
//System.log("REST Response Content: " + responseAsString);
var tenantName = JSON.parse(response.contentAsString)
System.log(tenantName.name)
return tenantName.name
}
else
System.error("Rest call to get the tenant name Status code: "+statusCodeAttribute)

Post a Comment (0)
Previous Post Next Post