Last Updated on : 2024-06-29 01:56:38download
Query the things data model defined for the specified device.
GET: /v2.0/cloud/thing/{device_id}/model
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
device_id | String | path | true | The device ID. |
Parameter name | Type | Description |
---|---|---|
result | Object | The returned result. |
Description of result
Parameter name | Type | Description |
---|---|---|
model | String | The functional definition of the specified things data model. For more information about the data format of model values, see Data description of the model field. |
GET: /v2.0/cloud/thing/372817193*****/model
{
"result": {
"model": "{\"modelId\":\"000004****\",\"services\":[{\"code\":\"\",\"description\":\"\",\"name\":\"\",\"actions\":[{\"code\":\"setPassword\",\"inputParams\":[{\"code\":\"password\",\"name\":\"Password\",\"typeSpec\":{\"typeDefaultValue\":\"\",\"type\":\"string\",\"maxlen\":1024}}],\"description\":\"Set or update the unlocking password on the app\",\"outputParams\":[{\"code\":\"state\",\"name\":\"State\",\"typeSpec\":{\"max\":100,\"scale\":0,\"type\":\"value\",\"unit\":\"\",\"min\":1,\"step\":0}}],\"name\":\"Set Password\",\"abilityId\":104}],\"events\":[{\"code\":\"doorStateEvent\",\"description\":\"Report the unlocking event when unlocking is triggered\",\"outputParams\":[{\"code\":\"doorState\",\"name\":\"Door State\",\"typeSpec\":{\"range\":[\"Open\",\"Closed\"],\"type\":\"enum\"}}],\"name\":\"Unlocking Event\",\"abilityId\":103}],\"properties\":[{\"code\":\"batterLevel\",\"description\":\"Battery level of the door lock\",\"accessMode\":\"rw\",\"name\":\"Remaining Battery Capacity\",\"typeSpec\":{\"max\":100,\"scale\":0,\"type\":\"value\",\"unit\":\"%\",\"min\":1,\"step\":0},\"abilityId\":102}]}]}"
},
"t": 1673423649773,
"success": true
}
For more information, see error code.
For more information, see Limits on API Request Frequency.
When you call the APIs related to the things data model, the return parameter includes
model
. The value format ofmodel
is the storage structure defined by the things data model in the Developer Platform system.
Parameter name | Type | Description |
---|---|---|
modelId | String | The ID of the specified things data model. |
services | List | The definition list of services. |
{
"modelId": "00000****",
"services": [
{
"code": "",
"name": "",
"description": "",
"properties": [
],
"actions": [
],
"events": [
]
}
]
}
Parameter name | Type | Description |
---|---|---|
code | String | The code to identify the specified service. An empty string represents the default service. |
name | String | The name of the specified service. |
description | String | The description or remarks of the specified service. |
properties | List | The list of property definitions. For the description of parameters in the property data structure, see Structure specification of property. |
actions | List | The list of action definitions. For the description of parameters in the action data structure, see Structure specification of action. |
events | List | The list of event definitions. For the description of parameters in the event data structure, see Structure specification of event. |
Parameter name | Type | Description |
---|---|---|
abilityId | Integer | The ID of the specified capability in the form of an integer value. The ID is unique in the same service. |
code | String | The code to identify the specified property. An empty string represents the default property. |
name | String | The name of the specified property. |
description | String | The description or remarks of the specified property. |
accessMode | String | The access mode. Valid values: ro : read-only. wr : write-only. rw : read-write. |
typeSpec | Object | The specification of data types, including value, float, double, string, date, bool, enum, raw, bitmap, struct, and array. For more information, see Data structure specification of typeSpec. |
Parameter name | Type | Description |
---|---|---|
abilityId | Integer | The ID of the specified capability in the form of an integer value. The ID is unique in the same service. |
code | String | The code of the specified action. The code is unique in the same service. |
name | String | The name of the specified action. |
description | String | The description or remarks of the specified action. |
inputParams | List | The input parameters for the specified action. For more information about the data structure, see Structure specification of inputParam and outputParam. |
outputParams | List | The output parameters for the specified action. For more information about the data structure, see Structure specification of inputParam and outputParam. |
Parameter name | Type | Description |
---|---|---|
abilityId | Integer | The ID of the specified capability in the form of an integer value. The ID is unique in the same service. |
code | String | The code of the specified event. The code is unique in the same service. |
name | String | The name of the specified event. |
description | String | The description or remarks of the specified event. |
outputParams | List | The output parameters for the specified event. For more information about the data structure, see Structure specification of inputParam and outputParam. |
Parameter name | Type | Description |
---|---|---|
code | String | The code of the specified parameter. |
name | String | The name of the specified parameter. |
typeSpec | Object | The specification of data types, including value, float, double, string, date, bool, enum, raw, bitmap, struct, and array. For more information, see Structure specification of typeSpec type. |
32-bit value type, which can be an integer or a decimal.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is value . |
min | Integer | Yes | The minimum value. |
max | Integer | Yes | The maximum value. |
step | Integer | No | The step of change. |
unit | String | No | The unit, such as cm. |
scale | Integer | No | The scale, used to represent decimals. The parameter value is the product of multiplying the actual value by the scale power of 10. Default value: 0. |
Type example
{
"type":"value",
"min":1,
"max":100,
"step":0,
"unit":"cm",
"scale":0
}
float
: single-precision floating-point number.double
: double-precision floating-point number.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is float or double . |
min | Integer | Yes | The minimum value. |
max | Integer | Yes | The maximum value. |
step | Integer | No | The step of change. |
unit | String | No | The unit, such as cm. |
Type example
{
"type":"float",
"min":0.1,
"max":100.1,
"step":0.1,
"unit":"cm"
}
Boolean type data. The value is true or false.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is bool . |
Type example
{
"type":"bool"
}
The timestamp type. It can be a 10-digit (in seconds) or 13-digit (in milliseconds) integer.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is date . |
Type example
{
"type":"date"
}
String type.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is string . |
maxlen | Integer | No | string: The maximum length of a string is 255. |
Type example
{
"type":"string",
"maxlen":100
}
The enum type.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is enum . |
range | List | Yes | The enumeration value. For example, the value is ["Male","Female"]. |
Type example
{
"type":"enum",
"range": [
"Male","Female"
]
}
Base64-encoded binary raw data.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is raw . Base64-encoded binary raw data. |
maxlen | Integer | No | The maximum number of bytes of binary data supported. |
Type example
{
"type":"raw",
"maxlen":128
}
The bitmap type, with up to 32 bits.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is bitmap . |
maxlen | Integer | No | The maximum number of bits supported. Maximum value: 32 bits. |
range | List | Yes | The description of each binary bit. |
Type example
{
"type":"bitmap",
"maxlen":31,
"label":[
"Fault 1","Fault 2"
]
}
Complex structure nesting. Currently, the data type of the struct property only supports value, string, bool, enum, and raw.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is struct . |
properties | Object | Yes | The struct object. For example, {"code1":"typeSpec","code2":"typeSpec"...}. The key is the property representation of the struct, and the value is the data type specification of the property, including value, float, double, string, date, bool, enum, raw, bitmap, struct, and array. For more information, see Structure specification of typeSpec type. |
Type example
{
"type":"struct",
"properties":{
"name":{
"type":"date"
},
"sex":{
"type":"enum",
"range":[
"Male",
"Female"
]
}
}
}
The data type of the elements in the array. Currently, only value, string, bool, and raw are supported.
Parameter name | Type | Required | Description |
---|---|---|---|
type | String | Yes | The value of type is array . |
maxSize | Integer | No | The maximum number of elements supported. |
elementTypeSpec | Object | Yes | The specification of data types for elements in the array, including value, float, double, string, date, bool, enum, raw, bitmap, struct, and array. For more information, see Structure specification of typeSpec type. |
Type example
{
"type":"array",
"maxSize":100,
"elementTypeSpec":{
"type":"date"
}
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback