ThingDatapoint Struct
Unit Struct
Multiplier
Error Codes
Samples
SDK Samples
V2.1 Search Thing Model(Deprecated)
Update Thing Model
Other References
V2.2 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.
This API is only available if 2.4 Cumulative Update 3 has been applied to your environment.
Request Parameters (URI)
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
orgId |
Query |
Required |
String |
The organization ID which the model belongs to. How to get orgId>> |
scope |
Query |
Optional |
Integer |
0: Only search from the organization specified by the orgId .
1 (default): Search from the organization specified by the orgId as well as the organizations with public models.
2: Only search from public models.
|
Request Parameters (Body)
Note
Use either expression or relationFilter to search, but not both together.
Name |
Required/Optional |
Data Type |
Description |
expression |
Optional |
String |
The query expression, which supports sql-like query. The fields that are supported for query include: modelId , tags , attribute_tags , measurepoint_tags , service_tags , and event_tags . Supports fuzzy query and logical operators “and” and “or”. How to use expression>>
modelId : supports arithmetic operator “in”.
tags , attribute_tags , measurepoint_tags , service_tags , and event_tags : supports arithmetic operator “=”, “exists”, “not exists”, and “like”. Note: EnOS Edge does not support tag queries.
|
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 , services , and events . 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 |
Optional |
RelationFilter Struct |
Query based on the relationship between models. For more information, see RelationFilter 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 |
The model category. |
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, of String type, and the value is of the ThingService Struct. For more information, see ThingService Struct. |
events |
Map |
The key is the event ID, of String type, and the value is of the ThingEvent Struct. For more information, see ThingEvent 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. |
desc |
String |
The attribute description. |
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. |
desc |
String |
The measurement point description. |
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. |
name |
StringI18n |
The service name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
desc |
String |
The service description. |
i18nDesc |
StringI18n |
The service 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.
|
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.
|
ThingEvent Struct
Name |
Data Type |
Description |
identifier |
String |
The event ID. |
name |
StringI18n |
The event name, supports internationalization. For more details on the structure and locales supported, see Internationalized name struct. |
desc |
String |
The event description. |
i18nDesc |
StringI18n |
The event 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.
|
outputData |
ThingDatapoint Struct |
The event’s output parameters list. For more information, see ThingDatapoint Struct. |
eventType |
String |
Event type. E.g.: INFO, WARN, ERROR |
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. |
desc |
String |
The data point description. |
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
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",
"category":"Planets",
"tags":{
},
"attributes":{
"starsystem":{
"identifier":"starsystem",
"name":{
"defaultValue":"star system",
"i18nValue":{
"en_US":"star system"
}
},
"desc":"Star system 1",
"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"
}
},
"desc":"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"
}
},
"desc":"Speedup",
"i18nDesc":{
"defaultValue":"Speedup",
"i18nValue":{
"en_US":"Speedup",
"zh_CN":"加速"
}
},
"tags":{
},
"outputData":[
{
"identifier":"delta",
"name":{
"defaultValue":"delta",
"i18nValue":{
"en_US":"delta"
}
},
"desc":"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"
}
},
"desc":"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"
}
},
"events":{
"alert":{
"identifier":"alert",
"name":{
"defaultValue":"alert",
"i18nValue":{
"en_US":"alert"
}
},
"desc":"Alert",
"i18nDesc":{
"defaultValue":"Alert",
"i18nValue":{
"en_US":"Alert",
"zh_CN":"告警"
}
},
"tags":{
},
"outputData":[
{
"identifier":"event1",
"name":{
"defaultValue":"event1",
"i18nValue":{
"en_US":"event1"
}
},
"desc":"Event 1",
"i18nDesc":{
"defaultValue":"Event 1",
"i18nValue":{
"en_US":"Event 1",
"zh_CN":"事件 1"
}
},
"tags":{
},
"dataType":"INT",
"unit":null
}
],
"eventType":"ERROR"
}
}
},
{
"modelId":"noiseSensor",
"modelIdPath":"/noiseSensor",
"orgId":"yourOrgId",
"name":{
"defaultValue":"Noise Sensor",
"i18nValue":{
"en_US":"Noise Sensor"
}
},
"desc":"Noise Sensor",
"category":"Sensors",
"tags":{
"group":"1"
},
"attributes":{
},
"measurepoints":{
},
"services":{
},
"events":{
}
}
],
"pagination":{
"pageNo":1,
"pageSize":10,
"totalSize":2
}
}
SDK Samples
You can access the SDK samples for model service on GitHub:
| |