Delete Logical Asset (Preview)¶
Delete a specified logical asset.
Operation Permissions¶
Required Authorization |
Required Operation Permission |
---|---|
Asset Tree Management |
Full Access |
Request Format¶
POST https://{apigw-address}/asset-service/v2.1/logical-assets?action=delete
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>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
assetId |
Mandatory |
String |
The asset ID. How to get assetId>> |
Error Codes¶
Code |
Message |
Description |
---|---|---|
17404 |
Logical asset does not exist |
The |
Samples¶
Request Sample¶
url: https://{apigw-address}/asset-service/v2.1/logical-assets?action=delete&orgId=yourOrgId
method: POST
requestBody:
{
"assetId":"yourAssetId"
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "01b5477a-374e-49a0-8b68-7dbfe8f0b74f"
}
Java SDK Sample¶
package com.envisioniot.enos.asset_tree_service;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.api.common.constant.request.Pagination;
import com.envisioniot.enos.api.common.constant.request.Projection;
import com.envisioniot.enos.asset_tree_service.v2_1.*;
import com.envisioniot.enos.asset_tree_service.vo.*;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
public class DeleteLogicAssetTest {
private static String accessKey = "yourAccessKey";
private static String secretKey = "yourSecretKey";
private static String orgId = "yourOrgId";
private static String serverUrl = "https://{apigw-address}";
@Test
public void testCreateAssetNode() {
DeleteLogicAssetRequest request = new DeleteLogicAssetRequest();
request.setOrgId(orgId);
request.setAssetId("yourAssetId"); //The logical asset ID to be deleted. Using a device asset ID will fail.
DeleteLogicAssetResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url(serverUrl).getResponse(request, DeleteLogicAssetResponse.class);
}
}