Get Attributes of an Entity

The API helps you to get the latest values of all the attributes set on an entity on which you have Read privilege. The API fetches attributes defined in vCenter Chargeback Manager and those imported from vCenter Server.

Syntax

The syntax for calling this method is:

GET <Base_Url>/hierarchy/{hierarchyId}/entity/{entityId}/attribute

A sample API call is as follows:

GET https://123.123.123.123/vCenter-CB/api/hierarchy/1/entity/51/attribute

User Privilege

To call this API, you should have Read privilege on the hierarchy and the entity.

API Response

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

XPath

Type

Min Occurs

Max Occurs

Description

Attributes/Attribute

 

0

unbounded

Represents the attributes of the entity

Attributes/Attribute/@id

xs:int

1

1

ID of the attribute.

Attributes/Attribute/Name

xs:string

1

1

Name of the attribute.

Attributes/Attribute/Description

xs:string

1

1

Description provided for the attribute.

Attributes/Attribute/Source

 

0

1

Represents the source of the attribute. If the <Source> element is empty then the attribute has been defined locally in vCenter Chargeback Manager. If it is a vCenter Server attribute, then it has been synchronized from vCenter Server.

Attributes/Attribute/Source/vCenter Server

 

0

1

Represents the vCenter Server from which the attribute has been synchronized.

Attributes/Attribute/Source/vCenter Server/@id

xs:int

1

1

ID of the vCenter Server.

Attributes/Attribute/Source/vCenter Server/Name

xs:value

1

1

Name of the vCenter Server.

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/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 is added to the parent.

Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute

 

0

unbounded

Represents the attributes of the entity.

Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute/@id

xs:int

1

1

The ID of the attribute

Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute/Value

xs:string

1

1

The value of the attribute specified for the entity.

A sample response is provided here.

Error Response

The API displays errors if inputs are incorrect or if the operation is unsuccessful for any reason. The following table explains the error codes displayed by the API.

Error Code

Description

VCB_ERR_INVALID_ENTITY_ID

Entity is not found.