VMware VCENTER CHARGEBACK 1.5 - API Manual page 18

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>
<VCenterServers>
<VCenterServer id="502">
</VCenterServer>
</VCenterServers>
</Request>
If successful, the API returns an XML file that indicates the status.
The following is an example program that calls the API.
/**
* This method is for adding a new vCenter-Server entity under
* vCenter-Chargeback Hierarchy entity
*
* @param requestFilePath
* @param baseURL
* @param hierachyId
* @param CBEntityId
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleAddNewVCenterServerEntity(String requestFilePath, String
PostMethod post = null;
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
NameValuePair[] parameters = {new NameValuePair("startTime",
String bodyString = CommonUtil.xmlAsString(requestDocument);
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
String uri = "https://" + baseURL + "/vCenter-CB/api/hierarchy/" + hierachyId +
HttpClient client = new HttpClient();
System.out.println(uri);
System.out.println(bodyString);
try {
} finally {
}
}
18
<VCenterServerView id = "2"/>
<Entities>
<Entity id="1062"/>
</Entities>
baseURL, int hierachyId, int CBEntityId, long startTime)
throws IOException, JDOMException, NoSuchAlgorithmException,
KeyManagementException, HttpException {
String.valueOf(startTime))};
FakeSSLCertificateSocketFactory(), 443));
"/entity/" + CBEntityId;
post = new PostMethod(uri);
post.setQueryString(parameters);
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