Get Thing Model¶
根据模型标识符(modelId
)获取模型。
操作权限¶
需授权的资源 |
所需操作权限 |
---|---|
模型管理 |
Read |
请求格式¶
GET https://{apigw-address}/model-service/v2.1/thing-models?action=get
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|---|
orgId |
Query |
必需 |
String |
资产所属的组织ID。如何获取 orgId 信息>> |
scope |
Query |
可选 |
Integer |
查询范围。 0:只从 orgId 指定的组织搜索; 1:从 orgId 指定的组织和公有模型所在的组织搜索。默认为1。 |
modelId |
Query |
必需 |
String |
资产所属模型ID。如何获取 modelId 信息>> |
响应参数¶
名称 |
数据类型 |
描述 |
---|---|---|
data |
ThingModel 结构体 |
物模型,见 ThingModel 结构体>> |
错误码¶
见 公共返回码(接入服务)。
示例¶
请求示例¶
url: https://{apigw-address}/model-service/v2.1/thing-models?action=get&orgId=yourOrgId&modelId=yourModelId
method: GET
返回示例¶
{
"code":0,
"msg":"OK",
"requestId":"41e3da4c-9e40-47e5-b202-58f946b294c5",
"data":{
"modelId":"jw-test1112",
"modelIdPath":"/jw-test1112",
"orgId":"yourOrgId",
"name":{
"defaultValue":"jw-test1112",
"i18nValue":{
"en_US":"",
"zh_CN":""
}
},
"desc":"jw-test1112",
"tags":{
},
"attributes":{
"capacity":{
"identifier":"capacity",
"name":{
"defaultValue":"capacity",
"i18nValue":{
"en_US":"capacity",
"zh_CN":"容量"
}
},
"desc":"capacity",
"tags":{
},
"stdElementId":"urn:user:modelelement:std:atom-property-int:1.0",
"isStdElement":true,
"dataType":"INT",
"unit":{
"unitId":"G",
"multiplier":"ONE"
},
"dataDefinition":null,
"isRequired":true,
"defaultValue":111
}
},
"measurepoints":{
"ActiveSC":{
"identifier":"ActiveSC",
"name":{
"defaultValue":"活动状态字",
"i18nValue":{
"en_US":"ActiveSC_Name"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"INT",
"unit":null,
"dataDefinition":null,
"hasQuality":false,
"signalType":"DI"
},
"windspeed_90":{
"identifier":"windspeed_90",
"name":{
"defaultValue":"windspeed_90",
"i18nValue":{
"en_US":"windspeed_90"
}
},
"desc":"90m wind speed",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"DOUBLE",
"unit":{
"unitId":"m/s",
"multiplier":"ONE"
},
"dataDefinition":null,
"hasQuality":false,
"signalType":"Generic"
},
"windspeed_80_identity":{
"identifier":"windspeed_80_identity",
"name":{
"defaultValue":"windspeed_80",
"i18nValue":{
"en_US":"windspeed_80"
}
},
"desc":"80m风速",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"DOUBLE",
"unit":{
"unitId":"m/s",
"multiplier":"ONE"
},
"dataDefinition":null,
"hasQuality":false,
"signalType":"Generic"
},
"windspeed_110":{
"identifier":"windspeed_110",
"name":{
"defaultValue":"windspeed_110",
"i18nValue":{
"en_US":"windspeed_110"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"DOUBLE",
"unit":{
"unitId":"m/s",
"multiplier":"ONE"
},
"dataDefinition":null,
"hasQuality":false,
"signalType":"AI"
},
"system_start":{
"identifier":"system_start",
"name":{
"defaultValue":"启动指令",
"i18nValue":{
"en_US":"",
"zh_CN":""
}
},
"desc":"",
"tags":{
"control":"true"
},
"stdElementId":null,
"isStdElement":false,
"dataType":"ENUM",
"unit":null,
"dataDefinition":{
"enumDesc": {
"0": {
"defaultValue": "关闭",
"i18nValue": {}
},
"1": {
"defaultValue": "打开",
"i18nValue": {}
},
"2": {
"defaultValue": "不定态",
"i18nValue": {}
},
"3": {
"defaultValue": "会不定态",
"i18nValue": {}
}
},
"enumType": "INT"
},
"hasQuality":false,
"signalType":"Generic"
},
"windspeed_140":{
"identifier":"windspeed_140",
"name":{
"defaultValue":"windspeed_140",
"i18nValue":{
"en_US":"windspeed_140"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"DOUBLE",
"unit":{
"unitId":"m/s",
"multiplier":"ONE"
},
"dataDefinition":null,
"hasQuality":false,
"signalType":"AI"
},
"cedianforsolar":{
"identifier":"cedianforsolar",
"name":{
"defaultValue":"cediantedsst",
"i18nValue":{
"en_US":"cediantedsst"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"DOUBLE",
"unit":null,
"dataDefinition":null,
"hasQuality":false,
"signalType":"Generic"
}
},
"services":{
"speedup":{
"identifier":"speedup",
"name":{
"defaultValue":"speedup",
"i18nValue":{
"en_US":"speedup"
}
},
"desc":"t",
"tags":null,
"stdElementId":null,
"isStdElement":false,
"outputData":[
{
"identifier":"delta",
"name":{
"defaultValue":"delta",
"i18nValue":{
"en_US":"delta"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"INT",
"unit":null,
"dataDefinition":null
}
],
"inputData":[
{
"identifier":"delta",
"name":{
"defaultValue":"delta",
"i18nValue":{
"en_US":"delta"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"INT",
"unit":{
"unitId":"rpm",
"multiplier":"ONE"
},
"dataDefinition":null
}
],
"callType":"ASYNC"
}
},
"events":{
"alert":{
"identifier":"alert",
"name":{
"defaultValue":"alert",
"i18nValue":{
"en_US":"alert"
}
},
"desc":"e",
"tags":null,
"stdElementId":null,
"isStdElement":false,
"outputData":[
{
"identifier":"event1",
"name":{
"defaultValue":"event1",
"i18nValue":{
"en_US":"event1"
}
},
"desc":"",
"tags":{
},
"stdElementId":null,
"isStdElement":false,
"dataType":"INT",
"unit":null,
"dataDefinition":null
}
],
"eventType":"ERROR"
}
}
}
}
Java SDK 调用示例¶
public class GetThingModel {
private static String accessKey = "AccessKey of your APP";
private static String secretKey = "SecretKey of your APP";
private static String orgId = "yourOrgId";
private static String url = "https://{apigw-address}";
public static void main(String[] args) {
GetThingModelRequest request = new GetThingModelRequest();
request.setOrgId(orgId);
request.setModelId("planet");
request.setScope(1);
GetThingModelResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url(url)
.getResponse(request, request.getResponseClass());
System.out.println(response.getData());
}
}