This API enables you to get all the details of an entity in a hierarchy. The details include hierarchy paths, and the percentage of shares for an entity.
If the entity is a vCenter entity, the API returns the details of the vCenter server to which the entity belongs and the details of the entity in the vCenter server hierarchy. These vCenter server entity details are useful in distinguishing entities having same names on two different vCenter servers that are added to one Chargeback folder.
GET <Base URL>/hierarchy/{hierarchyId}/entity/{entityId}
A sample API call is as follows:
GET https://123.123.123.123/vCenter-CB/api/hierarchy/1/entity/51
To call this API, you should have a role with Read privilege on the hierarchy and the entity.
If the operation is successful, the API returns an XML response with the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Hierarchies/Hierarchy |
|
1 |
1 |
Represents the hierarchy element to which entity belongs. |
Hierarchies/Hierarchy/@id |
xs:int |
1 |
1 |
ID of the hierarchy. |
Hierarchies/Hierarchy/Name |
xs:string |
1 |
1 |
Name of the hierarchy. |
Hierarchies/Hierarchy/Description |
xs:string |
1 |
1 |
Description provided for the hierarchy. |
Hierarchies/Hierarchy/CreatedOn |
xs:long |
1 |
1 |
Time, in milliseconds, when the hierarchy was created. |
Hierarchies/Hierarchy/InSync |
xs:boolean |
1 |
1 |
Indicates if the Chargeback hierarchy is synchronized with the vCenter Server hierarchy. Because the synchronization cannot be turned off, this value is always set to true. |
Hierarchies/Hierarchy/LastUpdatedTime |
xs:long |
1 |
1 |
Indicates the time when the Chargeback hierarchy was last updated. |
Hierarchies/Hierarchy/LastUpdatedUser |
xs:string |
1 |
1 |
Indicates the user who last updated the Chargeback hierarchy. If the hierarchy is automatically updated because of changes in the vCenter Server hierarchy, the user name is 'CBM Server'. |
Hierarchies/Hierarchy/Entities/Entity |
|
1 |
1 |
Represents the entity element. |
Hierarchies/Hierarchy/Entities/Entity/@id |
xs:int |
1 |
1 |
The ID of the entity in the hierarchy. |
Hierarchies/Hierarchy/Entities/Entity/Name |
xs:string |
1 |
1 |
Name of the entity. |
Hierarchies/Hierarchy/Entities/Entity/Description |
xs:string |
1 |
1 |
Description provided for the entity. |
Hierarchies/Hierarchy/Entities/Entity/Type |
xs:int |
1 |
1 |
Type of the entity. For more information, refer Chargeback EntityTypes. |
Hierarchies/Hierarchy/Entities/Entity/Shares/Share |
|
1 |
1 |
Represents the share of the entity element. |
Hierarchies/Hierarchy/Entities/Entity/Shares/Share/Percentage |
xs:int |
1 |
1 |
The shared percentage of the entity. |
Hierarchies/Hierarchy/Entities/Entity/Shares/Share/ParentPath |
xs:string |
1 |
1 |
The path from the root entity to the parent of this entity. The root entity path is indicated by /. |
Hierarchies/Hierarchy/Entities/Entity/Shares/Share/Parent/@id |
xs:int |
1 |
1 |
The ID of the parent entity. |
Hierarchies/Hierarchy/Entities/Entity/Shares/Share/StartTime |
xs:long |
1 |
1 |
Time, in milliseconds, when the entity was added to the parent. |
If the entity is a vCenter Server entity, the response XML also contains the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer |
|
1 |
1 |
Represents the vCenter Server from which you want to retrieve the hierarchy. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/@id |
xs:int |
1 |
1 |
The unique ID of the vCenter Server. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Name |
xs:string |
1 |
1 |
Name of the vCenter Server. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity |
|
0 |
unbounded |
Represents each entity in the vCenter hierarchy. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/@id |
xs:int |
1 |
1 |
The ID of the vCenter Server entity. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/Name |
xs:string |
1 |
1 |
Name of the entity. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/MoId |
xs:string |
1 |
1 |
The MoID (managed object ID) of the entity as defined in the vCenter Server. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/Type |
xs:int |
1 |
1 |
The type of the entity. For more information, see Chargeback Entity Types. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/ParentPath |
xs:string |
1 |
1 |
The path from the root entity to the parent of this entity in the vCenter Server hierarchy. The root entity path is indicated by /. |
Hierarchies/Hierarchy/Entities/Entity/VCenterServers/VCenterServer/Entities/Entity/Parent/@id |
xs:int |
1 |
1 |
The unique ID of the parent of this entity. If this is a root entity, it will not not have a parent and hence, the value is always -1. |
A sample response is provided here.
The following table explains the error codes returned by the API.
Error Code |
Description |
VCB_ERR_INVALID_ENTITY_ID |
Entity is not found |