2.0
Table Of Contents
- API Programming Guide
- Contents
- About This Book
- vCenter Chargeback Manager APIs
- Understanding the Workflow
- Using vCenter Chargeback Manager with a Billing System
- Index
API Programming Guide
32 VMware, Inc.
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
FakeSSLCertificateSocketFactory(), 443));
String uri = "https://" + baseURL + "/vCenter-CB/api/hierarchy/" + hierarchyId;
try {
get = new GetMethod(uri);
client.executeMethod(get);
System.out.println(get.getResponseBodyAsString());
} finally {
if (get != null) {
get.releaseConnection();
}
}
}
Add Report Schedule for Hierarchy
Youcanschedulereportstobegeneratedatregularintervals.Addareportscheduleforthehierarchybyusing
theReportScheduleAPI.
To add a report schedule for a hierarchy
1 CalltheReportScheduleAPIbyusingthefollowingURLinyourprogram.
POST <API base URL>/reportSchedule
Forexample,
POST https://123.123.123.123/vCenter-CB/api/reportSchedule
ThefollowingisanexamplerequestXML.
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<ReportSchedules>
<ReportSchedule>
<MetaData>
<Name>SampleReportSchedule</Name>
<Description></Description>
<ReportType>COST_REPORT</ReportType>
<OwnedByName></OwnedByName>
<ReportPeriodType>WEEKLY</ReportPeriodType>
<ReportPeriod>
<Weekly>
<StartDayOfWeek>1</StartDayOfWeek>
</Weekly>
</ReportPeriod>
<Hierarchies>
<Hierarchy id="1023">
<Entities>
<Entity id="1024" costModelId="30">
<Attributes operator="OR">
<Attribute id="10" criteria="EQUALS">
<Value>TestValue</Value>
</Attribute>
</Attributes>
</Entity>
</Entities>
</Hierarchy>
</Hierarchies>
<ComputingResources>
<ComputingResource id="1" />
<ComputingResource id="2" />
<ComputingResource id="5" />
<ComputingResource id="6" />
<ComputingResource id="9" />
<ComputingResource id="10" />
</ComputingResources>
</MetaData>
<Configuration>