Move Entity

This API moves an entity to a different parent within the same hierarchy.

Syntax

The syntax for calling this method is:

PUT <Base_Url>/hierarchy/{hierarchyId}/entity/{entityId}/move

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/hierarchy/1/entity/99/move

User Privilege

To call this API, you should have a role with Update privilege on hierarchy, the current parent entity, the entity being moved and the new parent entity.

URL Parameters

Name Data Type Required/Optional Description Sample Value
newParentEntityId Integer Required ID of the target parent entity 30

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 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 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_ENTITY_ID

Returned if the entity that is being moved is not found or if the new parent entity is not found in the hierarchy.

VCB_ERR_ENTITY_ALREADY_EXISTS

Returns if the child entity that is being moved already exists under the new parent.

VCB_ERR_PARENT_ENTITY_SAME

If the source parent entity is the same as the destination parent entity.

VCB_ERR_SHARED_ENTITY

If the entity that is being moved is shared or the entity's children are shared.

VCB_ERR_VC_ENTITY

If the new parent entity is a vCenter entity.

VCB_ERR_PARENT_MOVED_TO_CHILD

If the child that is to be added is an ancestor of parent, or in other words, if the parent is being moved to the child.

VCB_ERR_ROOT_ENTITY

If an entity is a root entity.

VCB_ERR_VC_ENTITY_CHILD

If any of the children of a vCenter entity is being moved.