ThingDatapoint Struct
Unit Struct
Multiplier
Error Codes
Samples
SDK Samples
Update Thing Model
Other References
Search Thing Model
Search models based on expressions or on the relationship between models.
If you need to invoke this API after Update Thing Model API, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.
Request Parameters (URI)
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
orgId |
Query |
Required |
String |
The OU ID which the model belongs to. How to get orgId>> |
scope |
Query |
Optional |
Integer |
0: Only search from the OU specified by the orgId .
1 (default): Search from the OU specified by the orgId as well as the OUs with shared models.
2: Only search from shared models.
|
Request Parameters (Body)
Name |
Required/Optional |
Data Type |
Description |
expression |
Optional |
String |
The query expression, which supports sql-like query. Supports using both expression and relationFilter for searching. The fields that are supported for query include: modelId , tags , attribute_tags , measurepoint_tags , and service_tags . Supports fuzzy query and logical operators “and” and “or”. How to use expression>>
modelId : supports arithmetic operator “in” and “like”.
modelName : supports arithmetic operator “like”.
tags , attribute_tags , measurepoint_tags , and service_tags : supports arithmetic operator “=”, “exists”, “not exists”, and “like”. Note: EnOS Edge does not support tag queries.
|
relationFilter |
Optional |
RelationFilter Struct |
Query based on the relationship between models. Supports using both expression and relationFilter for searching. For more information, see RelationFilter Struct. |
projection |
Optional |
Projection Struct |
Enables you to crop the data result set returned in the request if needed. Only the specified fields will be returned in the data result set if this parameter is used. Otherwise all fields are returned. The supported fields are: modelId , modelIdPath , orgId , name , desc , tags , attributes , measurepoints , and services . For more details, see How does projection crop the result set.
Note: EnOS Edge does not support this parameter.
|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. When not specified, 10 records are displayed per page by default. Note that if the pageSize number is big, the API response time will increase significantly for large models. For optimal performance, it is recommended to have not more than 25 records per page. sorters is not supported to sort the response. For more details, see Pagination Request Struct. |
RelationFilter Struct
Name |
Required/Optional |
Data Type |
Description |
relatedModelId |
Required |
String |
The model ID. |
relationType |
Required |
String |
The type of relationship with the model of the relatedModelId . There are two options available.
|
Response Parameters
Name |
Data Type |
Description |
data |
Array of ThingModel Structs |
A list of the thing models returned. For details of a Thingmodel Struct, see ThingModel Struct. |
ThingModel Struct
Name |
Data Type |
Description |
modelId |
String |
The model ID. |
modelIdPath |
String |
The model ID path. |
orgId |
String |
The OU ID that created this model. For example, if a model in OU B is created by sharing from OU A, when you query the information of that model in OU B, the returned ID will be from OU A. |
name |
StringI18n |
The model name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
desc |
String |
The model description. |
category |
String |
Model category. In EnOS 3.0.0 Model Management, model categories are no longer defined, and the categories of existing models will be added to the models as tags. |
tags |
Map |
User-defined tags. (The Key and Value are of String type.) |
attributes |
Map |
The key is the static attribute ID, of String type, and the value is of the ThingAttribute Struct. For more information, see ThingAttribute Struct. |
measurepoints |
Map |
The key is the measurement point ID, of String type, and the value is of the ThingMeasurepoint Struct. For more information, see ThingMeasurepoint Struct. |
services |
Map |
The key is the service ID(i.e. command ID in EnOS Model Management), of String type, and the value is of the ThingService Struct. For more information, see ThingService Struct. |
ThingAttribute Struct
Name |
Data Type |
Description |
identifier |
String |
The attribute ID. |
dataType |
String |
The data type. E.g.: ARRAY, BOOL, DATE, ENUM, INT, FLOAT, DOUBLE, STRUCT, STRING, TIMESTAMP, FILE |
dataDefinition |
String |
The data definition of the dataType in this structure, which is a JSON string. For example, when the dataType is “STRING”, it defines the string length; when the dataType is “ENUM”, it defines the value and description. How to use dataDefinition>> |
isRequired |
Boolean |
If true, the value of this attribute must be set when the asset is instantiated; otherwise the asset will return a validation failure error when it is created. |
defaultValue |
As defined in the thing model |
The default value of the attribute. If the attribute has no default value, defaultValue would be null . Note: EnOS Edge does not support this parameter. |
name |
StringI18n |
The attribute name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
i18nDesc |
StringI18n |
The attribute description, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
tags |
Map |
User-defined tags. (The Key and Value are of String type.) |
isStdElement |
Boolean |
Note: EnOS Edge does not support this parameter.
|
stdElementId |
String |
The URN of the element if isStdElement is true . The format is urn:enos:modelelement:std: <id> : <version> . id is the element ID. <version> is the version of the element.
If isStdElement is false , then stdElementId is null .
Note: EnOS Edge does not support this parameter.
|
unit |
Unit Struct |
For more information, see Unit Struct. |
ThingMeasurepoint Struct
Name |
Data Type |
Description |
identifier |
String |
The ID of the measurement point. |
dataType |
String |
Data type. E.g.: ARRAY, DATE, ENUM, INT, FLOAT, DOUBLE, STRUCT, STRING, TIMESTAMP, FILE |
dataDefinition |
String |
The data definition of the dataType in this structure, which is a JSON string. For example, when the dataType is “STRING”, it defines the string length; when the dataType is “ENUM”, it defines the value and description. How to use dataDefinition>> |
name |
StringI18n |
The measurement point name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
i18nDesc |
StringI18n |
The measurement point description, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
tags |
Map |
User-defined tags. (The Key and Value are of String type.) |
isStdElement |
Boolean |
Note: EnOS Edge does not support this parameter.
|
stdElementId |
String |
The URN of the element if isStdElement is true . The format is urn:enos:modelelement:std: <id> : <version> . id is the element ID. <version> is the version of the element.
If isStdElement is false , then stdElementId is null .
Note: EnOS Edge does not support this parameter.
|
hasQuality |
Boolean |
|
signalType |
String |
The signal/point type. E.g.: Generic, AI, PI, DI |
unit |
Unit Struct |
For more information, see Unit Struct. |
ThingService Struct
Name |
Data Type |
Description |
identifier |
String |
The service ID(i.e. command ID in EnOS Model Management). |
name |
StringI18n |
The service name(i.e. command name in EnOS Model Management), supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
i18nDesc |
StringI18n |
The service description(i.e. command description in EnOS Model Management), supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
tags |
Map |
User-defined tags. (The Key and Value are of String type.) |
isStdElement |
Boolean |
Note: EnOS Edge does not support this parameter.
|
stdElementId |
String |
The URN of the element if isStdElement is true . The format is urn:enos:modelelement:std: <id> : <version> . id is the element ID. <version> is the version of the element.
If isStdElement is false , then stdElementId is null .
Note: EnOS Edge does not support this parameter.
|
inputData |
ThingDatapoint Struct |
The service’s input parameters list. For more information, see ThingDatapoint Struct. |
outputData |
ThingDatapoint Struct |
The service’s output parameters list. For more information, see ThingDatapoint Struct. |
callType |
String |
The calling type. This parameter will be deprecated.
ASYNC : Asynchronous.
SYNC : Synchronous.
|
ThingDatapoint Struct
Name |
Data Type |
Description |
identifier |
String |
The data point ID. |
dataType |
String |
Data type. E.g.: ARRAY, DATE, ENUM, INT, FLOAT, DOUBLE, STRUCT, STRING, TIMESTAMP, FILE |
dataDefinition |
String |
The data definition of the dataType in this structure, which is a JSON string. For example, when the dataType is “STRING”, it defines the string length; when the dataType is “ENUM”, it defines the value and description. How to use dataDefinition>> |
name |
StringI18n |
The data point name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
i18nDesc |
StringI18n |
The data point description, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
tags |
Map |
User-defined tags. (The Key and Value are of String type.) |
isStdElement |
Boolean |
Note: EnOS Edge does not support this parameter.
|
stdElementId |
String |
The URN of the element if isStdElement is true . The format is urn:enos:modelelement:std: <id> : <version> . id is the element ID. <version> is the version of the element.
If isStdElement is false , then stdElementId is null .
Note: EnOS Edge does not support this parameter.
|
unit |
Unit Struct |
For more information, see Unit Struct. |
isRequired |
Boolean |
Applicable only for service inputData . If true (default) and defaultValue is null, the value of this data point must be given when invoking the service.
Note: EnOS Edge does not support this parameter.
|
defaultValue |
Depends on the data type |
The default value of the data point. If the data point has no default value, defaultValue would be null . Applicable only for service inputData .
Note: EnOS Edge does not support this parameter.
|
Unit Struct
Name |
Data Type |
Description |
unitId |
String |
The unit ID. |
multiplier |
String |
The multiplier of the unit. For more information, see Multiplier. |
Multiplier
The multiplier of the unit can have the following values:
YOTTA ,//Y 10^24
ZETTA ,//Z 10^21
EXA ,//E 10^18
PETA ,//P 10^15
TERA ,//T 10^12
GIGA ,//G 10^9
MEGA ,//M 10^6
KILO ,//k 10^3
HECTO ,//h 10^2
DECA ,//da 10^1
ONE ,// 10^0
DECI ,//d 10^-1
CENTI ,//c 10^-2
MILLI ,//m 10^-3
MICRO ,//μ 10^-6
NANO ,//n 10^-9
PICO ,//p 10^-12
FEMTO ,//f 10^-15
ATTO ,//a 10^-18
ZEPTO ,//z 10^-21
YOCTO ,//y 10^-24
Samples
Request Sample
Request samples include: Search by expression and search by model relationship.
Search By Expression
url: https://{apigw-address}/model-service/v2.2/thing-models?action=search&orgId=yourOrgId&scope=1
method: POST
requestBody:
{
"expression": "modelId in ('planet', 'noiseSensor')", // tags example: "tags.abc like '123'"
"pagination": {
"pageNo": 1,
"pageSize": 10
}
}
Search By Model Relationship
url: https://{apigw-address}/model-service/v2.2/thing-models?action=search&orgId=yourOrgId&scope=1
method: POST
requestBody:
{
"relationFilter": {
"relatedModelId": "modelId",
"relationType": "childOfModel"
},
"pagination": {
"pageNo": 1,
"pageSize": 10
}
}
Return Sample
{
"code":0,
"msg":"OK",
"requestId":"c6594307-bc30-4380-9869-b8a88b9494de",
"data":[
{
"modelId":"planet",
"modelIdPath":"/planet",
"orgId":"yourOrgId",
"name":{
"defaultValue":"planet",
"i18nValue":{
"en_US":"planet"
}
},
"desc":"Planet",
"tags":{
},
"attributes":{
"starsystem":{
"identifier":"starsystem",
"name":{
"defaultValue":"star system",
"i18nValue":{
"en_US":"star system"
}
},
"i18nDesc":{
"defaultValue":"Star system 1",
"i18nValue":{
"en_US":"Star system 1",
"zh_CN":"星系 1"
}
},
"tags":{
},
"stdElementId":"urn:user:modelelement:std:atom-property-int:1.0",
"isStdElement":true,
"dataType":"STRING",
"unit":null,
"isRequired":false,
"defaultValue":null
}
},
"measurepoints":{
"temperature":{
"identifier":"temperature",
"name":{
"defaultValue":"temperature",
"i18nValue":{
"en_US":"temperature"
}
},
"i18nDesc":{
"defaultValue":"Temperature",
"i18nValue":{
"en_US":"Temperature",
"zh_CN":"温度"
}
},
"tags":{
},
"stdElementId":"urn:user:modelelement:std:atom-property-int:1.0",
"isStdElement":true,
"dataType":"FLOAT",
"hasQuality":false,
"signalType":"Generic",
"unit":{
"unitId":"°C",
"multiplier":"ONE"
}
}
},
"services":{
"speedup":{
"identifier":"speedup",
"name":{
"defaultValue":"speedup",
"i18nValue":{
"en_US":"speedup"
}
},
"i18nDesc":{
"defaultValue":"Speedup",
"i18nValue":{
"en_US":"Speedup",
"zh_CN":"加速"
}
},
"tags":{
},
"outputData":[
{
"identifier":"delta",
"name":{
"defaultValue":"delta",
"i18nValue":{
"en_US":"delta"
}
},
"i18nDesc":{
"defaultValue":"Delta",
"i18nValue":{
"en_US":"Delta",
"zh_CN":"Delta 描述"
}
},
"tags":{
},
"dataType":"INT",
"unit":null
}
],
"inputData":[
{
"identifier":"delta",
"name":{
"defaultValue":"delta",
"i18nValue":{
"en_US":"delta"
}
},
"i18nDesc":{
"defaultValue":"Delta",
"i18nValue":{
"en_US":"Delta",
"zh_CN":"Delta 描述"
}
},
"tags":{
},
"dataType":"INT",
"unit":{
"unitId":"rpm",
"multiplier":"ONE"
},
"isRequired":false,
"defaultValue":3
}
],
"callType":"ASYNC"
}
}
},
{
"modelId":"noiseSensor",
"modelIdPath":"/noiseSensor",
"orgId":"yourOrgId",
"name":{
"defaultValue":"Noise Sensor",
"i18nValue":{
"en_US":"Noise Sensor"
}
},
"desc":"Noise Sensor",
"tags":{
"group":"1"
},
"attributes":{
},
"measurepoints":{
},
"services":{
}
}
],
"pagination":{
"pageNo":1,
"pageSize":10,
"totalSize":2
}
}
SDK Samples
You can access the SDK samples for Model Service APIs on GitHub:
| |