VMware, Inc. 9
Chapter 1 vCenter Chargeback Manager APIs
</Hierarchy>
</Hierarchies>
</Response>
IfanAPItaskisunsuccessful,thestatusparameterissettofailureandtheErrorelementcapturesallthe
details.
<?xml version="1.0" encoding="UTF-8"?>
<Response status="failure" isValidLicense="true"
xmlns="http://www.vmware.com/vcenter/chargeback/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Error majorErrorCode="500" minorErrorCode="2014"
message="Hierarchy with id '1' does not exist." />
</Response>
Table 1‐2explainsthecomponentsoftheErrorelement.
Common Elements in the Request and Response XMLs
Table 1‐3presentsthecommonXMLelementsusedbytherequestandresponseXMLs.
ForanexamplerequestXML,see“Requests.”ForanexampleresponseXML,see“Responses.”
vCenter Chargeback Manager API Syntax
EachvCenterChargebackManagerAPIhasthefollowingsyntax:
<HTTP_request_method> <Base_Url>/<API_signature>
Forexample,GET https://123.123.123.123/vCenter-CB/api/hierarchies
Table 1‐4describesthecomponentsofvCenterChargebackManagerAPIsyntax.
Table 1-2. Components of Error Element
Element Description
majorErrorCode Theclassoftheerror.ItrepresentstheHTTPStatuscodes.
minorErrorCode TheAPIerrorcode.Forexample,itcanindicatethathierarchycreationfailed.
vendorSpecificErrorCode
(Optional)
Avendororimplementation‐specificerrorcodethatpointstospecificmodulesorparts
ofthecode,andcanmakeproblemdiagnosticseasier.For
example,itcanindicateifa
codesnippetisavCenterChargebackManagererrorcodeoradatabaseerrorcode.
message Aone‐line,human‐readablemessagethatdescribestheerrorthatoccurred.
ErrorStackTrace ThiselementispresentwhentheloglevelinvCenterChargebackManagerissetto
debug.
Table 1-3. Common Elements
Element Description
Request AnAPIrequeststartswiththiselement.
Response AnAPIresponsestartswiththiselement.
status DenoteswhetherAPIissuccessfullyexecuted.
IsValidLicense Indicatesthestatusofthelicense.Valuecanbetrueorfalse.
Table 1-4. API Syntax Components
Syntax Component Description
HTTP_request_method PUT,POST,GET,orDELETE
Base_Url TheURLofthevCenterChargebackManager.ThebaseURLforvCenterChargeback
ManagerAPIsis:
https://<vCenter Chargeback Manager IP>/vCenter-CB/api
Forexample,https://123.123.123.123/vCenter-CB/api