Move Asset Node


Move an asset node, together with all its descendant nodes, to a specified location.

Operation Permissions

Required Authorization

Required Operation Permission

Asset Tree

Full Access

Request Format

POST https://{apigw-address}/asset-tree-service/v2.1/asset-nodes?action=move

Request Parameters (URI)

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

orgId

Query

Mandatory

String

The organization ID which the asset belongs to. How to get orgId>>

treeId

Query

Mandatory

String

The asset tree ID. How to get treeID>>

parentAssetId

Query

Mandatory

String

The asset ID of the parent node of assetId after it is moved. How to get assetId>>

preAssetId

Query

Optional

String

The asset ID of the sibling node prior to the assetId after it is moved. If null, the assetId will be moved to the first position under the parentAssetId. How to get assetId>>

assetId

Query

Mandatory

String

The asset ID of the asset node to be moved. How to get assetId>>

Examples

Assuming an asset tree has the following structure.


_images/move_asset_original_tree.png


Scenario 1: If parentAssetId is 7, preAssetId is 13, and assetId is 10, the new tree structure will be as per the below after the move.


_images/move_asset_example1.png


Scenario 2: If parentAssetId is 3, preAssetId is null, and assetId is 10, the new tree structure will be as per the below after the move.


_images/move_asset_example2.png


Scenario 3: If parentAssetId is 5, preAssetId is null, and assetId is 10, the new tree structure will be as per the below after the move.


_images/move_asset_example3.png

Error Codes

Code

Message

Description

99400

  • Invalid arguments

  • Parent asset is not exist in the tree

  • The request parameter is invalid. Check the request parameters.

  • The parent asset does not exist in this tree.

99500

System error

Internal server error. Contact EnOS support.

17404

Asset is not exist in the tree

The asset does not exist in this tree.

17762

The tree is locked

The asset tree cannot be modified/deleted for the time being as someone is currently accessing the asset tree. Please try again later.

17764

The root asset node can not be moved or deleted: or tree is not exist

The root asset node cannot be moved or the tree does not exist.

17768

Can not move to descendant node

Unable to move under one’s descendant.

17770

Exceeding the layer limit(7)

The tree exceeds the maximum number of layers (7 layers).

17777

Parent asset is invalid

The parentAssetId is invalid.

Samples

Request Sample

url:  https://{apigw-address}/asset-tree-service/v2.1/asset-nodes?parentAssetId=yourParrentAssetId&assetId=yourAssetId&preAssetId=yourPreAssetId&orgId=yourOrgId&treeId=yourTreeId&action=move
method: POST

Return Sample

{
  "code": 0,
  "msg": null,
  "requestId": "8d0b2297-4dce-48b5-b685-3bd30e4c4636",
  "data": null
}

SDK Samples


You can access the SDK samples for Asset Tree Service on GitHub: