Delete Asset Node


Remove an asset from an asset tree. The asset to be removed can be a device asset or a non-device (logical) asset.

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=delete

Request Parameters (URI)

Note

Use one of the following methods to identify the Asset to be deleted.

  • Include the assetId in the request (applicable for both device and logical assets)

  • Include both productKey and deviceKey in the request (applicable only for device asset)

Name

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 the ID of an asset tree>>

assetId

Query

Optional (See Note above)

String

The asset ID. How to get assetId>>

productKey

Query

Optional (See Note above)

String

The product key. To be used with deviceKey.

deviceKey

Query

Optional (See Note above)

String

The device key. To be used with productKey.

force

Query

Optional

Boolean

  • true: Deletes the node and all its child nodes.

  • false (default): Deletes the node if it is a leaf node. If child nodes exist, an error message will be returned.

Note: EnOS Edge does not support this parameter.

Error Codes

Code

Message

Description

17764

The root asset node cannot be deleted.

The root node cannot be deleted

17766

The noleaf asset node cannot be deleted.

Nodes with child nodes cannot be deleted.

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.

99400

Invalid arguments

The request parameter is invalid. Check the request parameters.

99404

TreeId is not exist

The tree ID does not exist.

99500

System error

Internal server error. Contact EnOS support.

Samples

Request Sample

url: https://{apigw-address}/asset-tree-service/v2.1/asset-nodes?action=delete&treeId=yourTreeId&orgId=yourOrgId&force=true
method: POST

Return Sample

{
  "code": 0,
  "msg": "ok",
  "requestId": "01b5477a-374e-49a0-8b68-7dbfe8f0b74f" ,
  "data": null
}

SDK Samples


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