1.5

VMware, Inc. 21
Chapter 2 Understanding the Workflow
} finally {
if (put != null) {
put.releaseConnection();
}
}
}
Generate a Report
UsetheGenerateReportAPItosendarequesttocreateareport.
To generate a report
1 CalltheAPIbyusingthefollowingsyntax.
<HTTP_request_method> <Base_URL>/report
Forexample,youcandefineacalllikethis:
POST https://123.123.123.123/vCenter-CB/api/report
2IntherequestXML,specifythefollowingdetailsaboutthehierarchy,entity,resourcecounters,andthe
costmodel.
Nameofthereport.
Descriptionofthereport.
Typeofthereportthatyouwanttogenerate.Youcangenerateacostreport,costcomparisonreport,
orausagereport.
Startandendtimesoftheperiodforwhichthereportistobegenerated.
IDsofthehierarchy,entity,costmodel,andcomputingresourceforwhichyouwanttogeneratethe
report.
ThefollowingisanexamplerequestXML.
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<Reports>
<Report>
<MetaData>
<Name>Name</Name>
<Description>Description</Description>
<ReportType>COST_REPORT</ReportType>
<ReportPeriod>
<From>1234567890</From>
<To>1234667890</To>
</ReportPeriod>
<OwnedBy>CreatedBy</OwnedBy>
<Hierarchies>
<Hierarchy id="590">
<Entities>
<Entity id="592" costModelId="30" />
<Entity id="593" costModelId="30" />
</Entities>
</Hierarchy>
</Hierarchies>
<!-- The CostModels section will be present only for cost comparison reports
-->
<CostModels>
<CostModel id="0" />
<CostModel id="2" />
</CostModels>
<ComputingResources>
<ComputingResource id="1" />
<ComputingResource id="2" />
<ComputingResource id="5" />
<ComputingResource id="6" />