Browse Entity of vCenter Server Hierarchy

This API enables you to browse a specific entity in a vCenter Server hierarchy. It returns the immediate child entities of the given entity.

Syntax

GET <Base URL>/vCenterServer/{vCenterServerId}/entity/{entityId}/browse

A sample API call is as follows:

GET https://123.123.123.123/vCenter-CB/api/vCenterServer/1/entity/51/browse

User Privilege

You must have a role with the Read privilege on the vCenter Server and on the hierarchy you specify as a URL parameter.

URL Parameters

Parameter

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

numbeOfChildren

Integer

Optional

Use this to specify the number of immediate child entities the API should return. If this parameter is not specified, the API returns the entire list of immediate child entities.

If value is 0, the API does not return any children. If the value is more than the actual number of remaining children, the API returns only the actual number of remaining children.

1

fromIndex

Integer

Optional

Indicates the index from which the API should return the details. For example, if you specify 5, the API returns the entities starting from the fifth index.

If this parameter is not specified, the API gives the children starting from the first index.

2

API Response

If the operation is successful, the API returns 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 on entity types, 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/ChildrenCount

xs:int

1

1

Indicates the number of immediate child entities.

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.

 

Error Response

The following table explains the error codes returned 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.

VCB_ERR_INVALID_ENTITY_ID

Entity is not found