vCenter Chargeback API Programming Guide
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 Re-schedule report in vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @param scheduleId
* @throws IOException
* @throws HttpException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws JDOMException
*/
public static void sampleRescheduleReport(String requestFilePath, String baseURL, int
PutMethod put = 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/reportSchedule/" + scheduleId;
try {
} finally {
}
}
Delete Report Schedule
Currently, the Reschedule Report API updates only the schedule information and not the entity to cost model
mapping. So, you need to delete the report schedule and create a new one if you want to add, modify, or delete
any entity to cost model mappings if any new customer is getting added.
To delete a report schedule
1
Call the Delete Schedule API by using the following URL in your program.
DELETE <API base URL>/reportSchedule/{scheduleId}
For example,
DELETE https://123.123.123.123/vCenter-CB/api/reportSchedule/5
The response XML indicates that the delete operation is successful.
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 is to delete report schedule in vCenter-ChargeBack
*
* @param baseURL
* @param scheduleId
* @throws IOException
* @throws HttpException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws JDOMException
*/
36
scheduleId) throws HttpException, IOException,
KeyManagementException, NoSuchAlgorithmException, JDOMException {
FakeSSLCertificateSocketFactory(), 443));
put = new PutMethod(uri);
put.setRequestBody(bodyString);
client.executeMethod(put);
System.out.println(put.getResponseBodyAsString());
if (put != null) {
put.releaseConnection();
}
VMware, Inc.