Inputs:-
machineName(string)
vraHost (vra:host)
var nameFilter = "name eq '" + machineName + "'";
var parameters = "$filter=" + encodeURIComponent(nameFilter).replace("'", "%27");
var url = "/iaas/api/machines?"+parameters
var restClient = vraHost.createRestClient();
var request = restClient.createRequest("GET", url);
request.setHeader("Content-Type", "application/json")
var response = restClient.execute(request);
statusCodeAttribute = response.statusCode;
System.log("REST Response Status Code: " + statusCodeAttribute);
responseAsString = response.contentAsString;
//System.log("REST Response Content: " + responseAsString);
var machine = JSON.parse(response.contentAsString)
System.log(JSON.stringify(machine))
return machine.content[0].id