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
10 VMware, Inc.
IfyouwanttouseanearlierversionofthevCenterChargebackManagerAPI,youmustperformthefollowing
tasks:
IntheAPIURL,specifyversion=<version_number>.
Forexample,<HTTP_request_method> <Base_Url>/<API_signature>?version=1.5.0
IntherequestXML,updatetherequestelementwiththefollowingtag:
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
API Versioning
EveryvCenterChargebackManagerAPIrequestandresponseincludestargetnamespacetodenotetheAPI
version.For example,thefollowingrequestXMLsendstheversionwithwhichitisworking.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/2.0">
<Hierarchies>
<Hierarchy>
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
</Hierarchy>
</Hierarchies>
</Request>
TherequeststatesthatvCenterChargebackManagerAPIversion2.0isbeingcalled.Iftherequestisfor
vCenterChargebackManagerversion1.5,thecallfails.IftherequestisforvCenterChargebackManager2.0,
thecallsucceedsandgetsaresponsesimilartothefollowing:
<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns="http://www.vmware.com/vcenter/chargeback/2.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>
API_signature TheURLpathforavCenterChargebackManagerAPI.Forexample,/hierarchies
retrievesthehierarchiesaddedtothevCenterChargebackManagerrunningon
123.123.123.123.
version (Optional)APIversion.IfyouwanttousevCenterChargebackManager1.5API,then
specifytheversionas1.5.0.
Ifyoudonotspecifytheversion,thecurrentAPIversion,
whichis2.0,isconsidered.Forexample,
GET https://12.123.12.123/vCenter-CB/api/hierarchies?version=2.0
NOTEEnsurethatyouspecifytheversioninboththeAPIURLandtherequestXML.
Table 1-4. API Syntax Components
Syntax Component Description