Delete Logical Asset(Preview)


删除指定的逻辑资产。

操作权限

需授权的资源

所需操作权限

资产树管理

Full Access

请求格式

POST https://{apigw-address}/asset-service/v2.1/logical-assets?action=delete

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

资产所属的组织 ID。如何获取 orgId 信息>>

assetId

Query

必需

String

需要删除的逻辑资产 ID。如何获取 Asset ID 信息>>

错误码

示例

请求示例

url: https://{apigw-address}/asset-service/v2.1/logical-assets?action=delete&orgId=yourOrgId&assetId=yourAssetId
method: POST

返回示例

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

Java SDK 调用示例

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 = "yourServerUrl";

    @Test
    public void testCreateAssetNode() {
        DeleteLogicAssetRequest request = new DeleteLogicAssetRequest();
        request.setOrgId(orgId);
        request.setAssetId("yourAssetId");//删除的逻辑资产ID,填设备资产ID则删除失败
        DeleteLogicAssetResponse response = Poseidon.config(PConfig.init().appKey(AccessKey).appSecret(SecretKey).debug())
            .url(ServerUrl).getResponse(request, DeleteLogicAssetResponse.class);

    }
}