Get Hierarchy

The API enables you to query for a specific hierarchy using the specified ID.

In the response, the API filters out all the entities on which you have No Access role.

Syntax

The syntax for calling this method is:

GET <Base URL>/hierarchy/{hierarchyId}

A sample API call is as follows:

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

User Privilege

You must have a role with the Read privilege on the hierarchy you want to get.

URL Parameters

Parameter

Data Type

Required/Optional

Description

Sample Value

childrenNeeded

Boolean

Optional

If the value is true, the API returns the hierarchy and the child entities. If the value is false, the API returns only the hierarchy. The default value is true.

false

Request Body Parameters

This API does not need a request XML.

API Response

If the operation is successful, the API gets an XML response with the following details.

XPath

Type

Min Occurs

Max Occurs

Description

Hierarchies/Hierarchy

 

1

1

Represents the hierarchy element that is retrieved.

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 of 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 each entity element that is created.

Hierarchies/Hierarchy/Entities/Entity/@id

xs:int

1

1

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 on various entity types, see Chargeback Entity Types.

Hierarchies/Hierarchy/Entities/Entity/Shares/Share

 

1

1

Represents the share of the root 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/Parent/@id

xs:int

1

1

ID of the parent entity. If this is a root entity, it will not have a parent. 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. Will always be zero for the root entity.

A sample response is provided here.

Error Response

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

Error Code

Description

VCB_ERR_INVALID_HIERARCHY_ID

Hierarchy with the specified ID is not found.