请求接口
PUT /api/device/instance/{id}/metadata
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
X-Access-Token | header | string | true | 平台 token |
id | path | string | true | 设备ID |
body | body | object | true | - |
» functions | body | [object] | false | 功能 |
» properties | body | integer | false | 属性 |
»» id | body | string | false | 标识 |
»» name | body | string | false | 名称 |
»» description | body | string | false | 说明 |
»» valueType | body | object | false | json对象 |
»»» expands | body | object | false | - |
»»» type | body | string | false | 数据类型 |
»»» elements | body | string | false | - |
»» expands | body | object | false | - |
»»» source | body | string | false | 属性来源 |
»»» metrics | body | [object] | false | - |
»»» type | body | [object] | false | 属性类型,可选值:"read"(读)、"write"(写)、"report"(上报) |
响应参数
以200 Response为例,响应参数如下:
名称 | 类型 | 说明 |
---|---|---|
»message | string | 返回信息 |
»status | integer(int32) | 响应状态码 |
»timestamp | integer(int64) | 时间戳(毫秒) |
响应状态码
状态码 | 状态码含义 | 说明 |
---|---|---|
200 | OK | 成功 |
401 | Unauthorized | 登录状态已过期,token不能为空 |
500 | Internal Server Error | 服务器内部异常 |
Body示例
json
{
"functions":[],
"properties":[
{
"id":"real_state_net",
"valueType": {
"expands":{},
"type":"string"
},
"name":"网络",
"description":"网络",
"expands":{
"source":"device",
"metrics":[],
"type":["read","report"]
}
},
{
"id":"real_state_system_version",
"valueType":{
"expands":{},
"type":"string"
},
"name":"系统版本",
"description":"系统版本",
"expands":{
"source":"device",
"metrics":[],
"type":["read","report"]
}
},
{
"valueType": {
"type":"string",
"expands":{},
"elements":[{}]
},
"expands":{
"type":["read","write","report"],
"metrics":[]
},
"id":"1111",
"name":"11",
"sortsIndex":0
}
],
"events":[],
"tags":[]
}
{
"functions":[],
"properties":[
{
"id":"real_state_net",
"valueType": {
"expands":{},
"type":"string"
},
"name":"网络",
"description":"网络",
"expands":{
"source":"device",
"metrics":[],
"type":["read","report"]
}
},
{
"id":"real_state_system_version",
"valueType":{
"expands":{},
"type":"string"
},
"name":"系统版本",
"description":"系统版本",
"expands":{
"source":"device",
"metrics":[],
"type":["read","report"]
}
},
{
"valueType": {
"type":"string",
"expands":{},
"elements":[{}]
},
"expands":{
"type":["read","write","report"],
"metrics":[]
},
"id":"1111",
"name":"11",
"sortsIndex":0
}
],
"events":[],
"tags":[]
}
返回示例
以200 Response为例:
json
{
"message":"success",
"status":200,
"timestamp":1690877241779
}
{
"message":"success",
"status":200,
"timestamp":1690877241779
}