1.5

vCenter Chargeback API Programming Guide
10 VMware, Inc.
IfyouwanttousevCenterChargeback1.0.1APIs,youneedtodothefollowingtasks:
IntheAPIURL,specifyversion=1.0.1.
Forexample,<HTTP_request_method> <Base_Url>/<API_signature>?version=1.0.1
IntherequestXML,updatetherequestelementwiththefollowingtag:
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
API Versioning
EveryvCenterChargeback1.5.0APIrequestandresponseincludestargetnamespacetodenotetheAPI
version.For example,thefollowingrequestXMLsendstheversionwithwhichitisworking.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
<Hierarchies>
<Hierarchy>
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
</Hierarchy>
</Hierarchies>
</Request>
TherequeststatesthatvCenterChargebackAPIversion1.5.0isbeingcalled.IftherequestisforvCenter
Chargebackserverversion1.0.1,thecallfails.IftherequestisforvCenterChargebackserver1.5.0,thecall
succeedsandgetsaresponsesimilartothefollowing.
<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="success"
isValidLicense="true">
<Hierarchies>
<Hierarchy id="1174">
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
<CreatedOn>1275033342320</CreatedOn>
<InSync>true</InSync>
<LastUpdatedTime>1275033342350</LastUpdatedTime>
<LastUpdatedUser>local\superuser</LastUpdatedUser>
<Entities>
<Entity id="1175">
<Name>Test_Hierarchy</Name>
<Description>Root</Description>
<Type>100</Type>
<Shares>
<Share>
<Percentage>100</Percentage>
<Parent id="-1" />
<StartTime>0</StartTime>
</Share>
</Shares>
</Entity>
</Entities>
</Hierarchy>
</Hierarchies>
</Response>
IfyouspecifytheAPIversion,besuretospecifyitwithboththerequestXML(whereverapplicable)andthe
URL.IfitisspecifiedonlyintherequestXMLortheURLandnotboth,thentheAPIresultsinanerror.Ifthe
APIversionisabsentinboth
theURLandtherequestXML(whereverapplicable),thentheAPIreturnsthe
outputcorrespondingtothelatestversion.