Skip to content

Instantly share code, notes, and snippets.

@jreypo
Created April 20, 2014 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jreypo/11114833 to your computer and use it in GitHub Desktop.
Save jreypo/11114833 to your computer and use it in GitHub Desktop.
//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