1.0.1
Table Of Contents
vCenter Chargeback API Programming Guide
10 VMware, Inc.
API Versioning
EveryvCenterChargeback1.0.1APIrequest/responseincludestargetnamespacetodenoteitsversion.
For example,thefollowingAPIrequestsendstheversionwithwhichitisworking.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.0.1">
<Hierarchies>
<Hierarchy>
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
</Hierarchy>
</Hierarchies>
</Request>
Therequeststatesthat,vCenterChargebackAPIversion1.0.1needstobecalled.IftherequestisforvCenter
Chargebackserverversion1.0,thiscallfails.IftherequestisforvCenterChargebackserver1.0.1,thecall
succeedsandgetsaresponseasfollows.
<?xml version="1.0" encoding="UTF-8"?>
<Response status="success" isValidLicense="true"
xmlns="http://www.vmware.com/vcenter/chargeback/1.0.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Hierarchies>
<Hierarchy id="5">
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
<InSync>true</InSync>
<LastUpdatedTime>1251892244029</LastUpdatedTime>
<LastUpdatedUser>local\admin</LastUpdatedUser>
<Entities>
<Entity id="119">
<Name>Test_Hierarchy</Name>
<Description>Root</Description>
<Type>100</Type>
<Shares>
<Share>
<Percentage>100</Percentage>
<Parent id="-1" />
</Share>
</Shares>
</Entity>
</Entities>
</Hierarchy>
</Hierarchies>
</Response>
ThisresponseindicatesthatvCenterChargebackAPI1.0.1iscalled.AlltheAPIsstartingfromversion1.0.1
willbebackwardcompatible.Thatis,arequestforvCenterChargebackAPI1.0.1tovCenterChargeback1.2
server,willbevalid.
TheAPIversion,ifbeingspecified,shouldbepresentinboththerequest
XML(whereverapplicable)andin
theURL.IfitisspecifiedonlyintherequestXMLortheURLandnotboth,thentheAPIdisplaysanerror.
If theAPIversionisabsentinboththeURLandtherequestXML(whereverapplicable),thentheAPIreturns
theoutputcorresponding
tothelatestversion.
URI Versioning
IntheURIofanAPI,youcanpassanoptionalparametertoindicatetheoutputversionyouexpectasshown
inthefollowingexample:
HTTP_request_method> <Base_Url>/<API_signature>?[version=1.0.1]
Ifyoudonotprovidetheversion,theAPIreturnstheoutputcorrespondingtothelatestversion.