Get Entities in Chargeback Hierarchy for a vCenter Server

This API helps retrieve a list of entities in Chargeback hierarchies for a vCenter server. However, it returns only hierarchies and entities on which you have Read privilege.

It retrieves only the vCenter Server entities directly added to the hierarchies and not their child entities. For example, if you added an ESX host that contains virtual machines to a hierarchy, this API retrieves the host information, but not the virtual machine information.

Query Parameters

Name

Data Type

Required/Optional

Description

Sample Value

vCenterServerId Integer Required ID of the vCenter server 1

Syntax

The syntax for calling this method is:

GET <Base_Url>/hierarchy/entities

A sample API call is as follows:

GET https://123.123.123.123/vCenter-CB/api/hierarchy/entities

User Privilege

To call this API, you should have a role with Read privilege on vCenter Server.

API Response

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 that is created.

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

unbounded

Represents each entity element that is created.

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 of the entity.

Hierarchies/Hierarchy/Entities/Entity/Type

xs:int

1

1

Type of the entity. For more information, see Chargeback Entity Types.

Hierarchies/Hierarchy/Entities/Entity/Shares/Share

 

1

1

Represents the share of the entity element with its parent.

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. If this is a root entity, it will not not have a parent and hence, the value is always -1.

Hierarchies/Hierarchy/Entities/Entity/Shares/Share/StartTime

xs:long

1

1

Time, in milliseconds, when the entity was added to the parent.

A sample response is provided here.

Error Response

The following table explains the error codes returned by the API.

Error Code

Description

VCB_ERR_INVALID_VCENTER_SERVER_ID

An invalid vCenter identifier is specified