Skip to content

Instantly share code, notes, and snippets.

@jreypo
Created April 20, 2014 14:00
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/11114815 to your computer and use it in GitHub Desktop.
Save jreypo/11114815 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 + "\">" +
" <Hierarchies>" +
" <Hierarchy>" +
" <Name>" + hierarchyName + "</Name>" +
" <Description>" + hierarchyDescription + "</Description>" +
" </Hierarchy>" +
" </Hierarchies>" +
"</Request>";
var inParamtersValues = [];
var apiRequest = restCreateHiearchy.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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment