The API enables you to browse a vCenter Server hierarchy. The API returns the root entity of the hierarchy. If you want to further browse, use the Browse Entity of the vCenter Server Hierarchy API.
The syntax for calling this method is:
GET <Base URL>/vCenterServer/{vCenterServerId}/browse
A sample API call is as follows:
GET https://123.123.123.123/vCenter-CB/api/vCenterServer/1/browse
You must have a role with the Read privilege on the vCenter Server and on the hierarchy you specify as a URL parameter.
Name |
Data Type |
Required/Optional |
Description |
Sample Value |
---|---|---|---|---|
vcViewId |
Integer |
Required |
Specify the vCenter inventory view ID. A value of 1 indicates the Hosts and Clusters view. A value of 2 indicates the Virtual Machines and templates view. |
1 (Hosts & Clusters) |
hierarachyId |
Integer |
Optional |
ID of the Chargeback hierarchy that you want to compare with the vCenter server hierarchy.
|
1 |
This API does not need a request XML.
If the operation is successful, the API gets an XML response with the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
VCenterServers/VCenterServer |
|
1 |
1 |
Represents the vCenter Server from which you want to retrieve the hierarchy. |
VCenterServers/VCenterServer/@id |
xs:int |
1 |
1 |
ID of the vCenter Server. |
VCenterServers/VCenterServer/Name |
xs:string |
1 |
1 |
Name of the vCenter Server. |
VCenterServers/VCenterServer/Entities/Entity |
|
0 |
unbounded |
Represents each entity in the vCenter hierarchy. |
VCenterServers/VCenterServer/Entities/Entity/@id |
xs:int |
1 |
1 |
ID of the vCenter Server entity. |
VCenterServers/VCenterServer/Entities/Entity/Name |
xs:string |
1 |
1 |
Name of the entity. |
VCenterServers/VCenterServer/Entities/Entity/MoId |
xs:string |
1 |
1 |
MoID (managed object ID) of the entity as defined in the vCenter Server. |
VCenterServers/VCenterServer/Entities/Entity/Type |
xs:int |
1 |
1 |
Type of the entity. For more information, see Chargeback Entity Types. |
VCenterServers/VCenterServer/Entities/Entity/Parent/@id |
xs:int |
1 |
1 |
ID of this entity's parent. If this is a root entity, it will not not have a parent and hence, the value is always -1. |
VCenterServers/VCenterServer/Entities/Entity/StateInCbHierarchy |
xs:boolean |
0 |
1 |
Indicates if the vCenter Server entity is present in vCenter Chargeback Manager. A value of 0 - indicates that the entity is not present in vCenter Chargeback Manager. 1 - indicates that some of the child entities of the entity are present in vCenter Chargeback Manager. 2 - indicates that the entity and all its children are present in vCenter Chargeback Manager. |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error Code |
Description |
VCB_ERR_INVALID_VCENTER_SERVER_ID |
The specified vCenter server ID is invalid. |
VCB_ERR_INVALID_VC_VIEW_TYPE |
vCenter server view type is invalid. |
VCB_ERR_INVALID_HIERARCHY_ID |
The specified Chargeback hierarchy ID is invalid. |