Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//API request payload in XML format
var payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<Request xmlns=\"http://www.vmware.com/vcenter/chargeback/" + cbmVersion + "\">" +
" <FixedCosts>" +
" <FixedCost>" +
" <Name>" + fixedCostName + "</Name>" +
" <Description>" + fixedCostDescription + "</Description>" +
" <Currency id=\"" + fixedCostCurrency + "\"/>" +
" <IsProrated>" + isProrated + "</IsProrated>" +
" <IsPowerStateBased>" + isPowerStateBased + "</IsPowerStateBased>" +
" <Type id=\"" + fixedCostType + "\"/>" +
" </FixedCost>" +
" </FixedCosts>" +
"</Request>";
var inParamtersValues = [];
var apiRequest = restCreateFixedCost.createRequest(inParamtersValues, payload);
apiRequest.contentType = "xml/string";
//execute request
var apiResponse = apiRequest.execute();
// REST operation output
httpCode = apiResponse.statusCode;
System.log("HTTP Status code: " + httpCode);
var responseString = apiResponse.contentAsString;
System.log("API Response: " + responseString);
var responseString = apiResponse.contentAsString;
System.log("API Response: " + responseString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment