Insights Hub 在Asset Management Service中,如何调用asset type( api/assetmanagement/v3/assettypes/{id}) 接口?

2024-06-11T13:23:53.000-0400
APIs & Services

摘要

在使用Insights Hub的过程中,我们可能会根据Insights Hub平台提供服务API,开发自己的App,如果需要使用Asset Management Service 提供asset type API, 如何使用 api/assetmanagement/v3/assettypes/{id}) 接口?


详细信息

 在使用Insights Hub的过程中,我们可能会根据Insights Hub平台提供服务API,开发自己的App,如果需要使用Asset Management Service 提供asset type API, 如何使用 api/assetmanagement/v3/assettypes/{id}) 接口?首先这个API是基于此服务提供的api/assetmanagement/v3/aspecttypes/{Id} API使用。如果我们要想成功调用api/assetmanagement/v3/assettypes/{id},我们线调用api/assetmanagement/v3/aspecttypes/{Id} API创建aspecttype。

调用的body信息如下:

{
    "name": "test_aspect_zjb",
    "category": "static",
    "scope": "private",
    "description": "test api use--zjb",
    "variables": [{
            "name": "temperature",
            "dataType": "STRING",
            "unit": "C/F",
            "searchable": true,
            "length": 5,
            "defaultValue": "25/77",
            "qualityCode": true
        }
    ]
}

body的填写信息如图所示:

点击send 按钮之后,可以看到接口调用成功,如下图所示:

从返回的内容中,我可以看到aspect type id是supplab.test_aspect_zjb, aspect名称是test_aspect_zjb。

在调用API的body信息添加aspect type id和aspect 名称。body信息如下:

{
    "name": "test_assettype_zjb",
    "description": "test assettype api apply zjb",
    "parentTypeId": "core.basicasset",
    "instantiable": true,
    "scope": "private",
    "aspects": [{
            "name": "test_aspect_zjb",
            "aspectTypeId": "supplab.test_aspect_zjb"
        }
    ],
    "variables": [{
            "name": "temperature",
            "dataType": "STRING",
            "unit": "C/F",
            "searchable": true,
            "length": 5,
            "defaultValue": "25/77"
        }
    ],
    "fileAssignments": []
}

body添加信息如下图所示:

点击send按钮,可以看到接口调用成功,创建asset type是supplab.test_assettype_zjb。如下图所示:

以上API的调用过程是在开发应用过程中,有可能需要在应用中通过代码创建asset type。我们在Asset Manager中也可以通过界面手动输入信息创建。手动创建过程可以参考Asset Manager 操作手册,请查看链接:https://documentation.mindsphere.io/resources/html/asset-manager/zh-CN/113554363275.html

知识库文章 ID# KB000133184_ZH_CN

内容

摘要详细信息

关联组件

Agent Management Service