VMware VCENTER CHARGEBACK 1.5 - API Manual page 34

Vcenter chargeback api programming guide
Hide thumbs Also See for VCENTER CHARGEBACK 1.5 - API:
Table of Contents

Advertisement

vCenter Chargeback API Programming Guide
The following is an example request XML. 
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<SearchQueries>
<SearchQuery id="reportSchedule">
<Criteria type="AND">
</Criteria>
<SortBy>
</SortBy>
<Pagination>
</Pagination>
</SearchQuery>
</SearchQueries>
</Request>
The following is an example program that calls the API. This program assumes that the request XML is 
populated with the required information.
/**
* This method get schedule by hierarchy name from vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @throws IOException
* @throws HttpException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws JDOMException
*/
public static void sampleGetScheduleByHierarchyName(String requestFilePath, String
PostMethod post = null;
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
String bodyString = CommonUtil.xmlAsString(requestDocument);
HttpClient client = new HttpClient();
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
String uri = "https://" + baseURL + "/vCenter-CB/api/search";
try {
} finally {
}
}
34
<Filter name="name" type="LIKE" value="%reportSchedule1%" />
<Filter name="desc" type="LIKE" value="%reportScheduleDesc1%" />
<Filter name="costModelName" type="EQUAL" value="costModel1"/>
<Params>
<Param index="1" order="DESC">name</Param>
</Params>
<FirstResultCount>0</FirstResultCount>
<MaxResultCount>100</MaxResultCount>
baseURL) throws HttpException, IOException, KeyManagementException,
NoSuchAlgorithmException, JDOMException {
FakeSSLCertificateSocketFactory(), 443));
post = new PostMethod(uri);
post.setRequestBody(bodyString);
client.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
if (post != null) {
post.releaseConnection();
}
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents