请求接口
POST /api/device/invoked/{deviceId}/function/{functionId}
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| X-Access-Token | header | string | true | 平台 token |
| deviceId | path | string | true | 控制器设备ID |
| functionId | path | string | true | 功能标识,为固定值DeviceCtrl |
| Location | body | string | true | 边缘设备所在位置 |
| ProductID | body | string | true | 边缘设备所属产品ID |
| OperCode | body | object | true | 操作编码 |
| »属性1 | body | string | true | 填入相应的属性 |
| »属性2 | body | integer | true | 温度 |
响应参数
以200 Response为例,响应参数如下:
| 名称 | 类型 | 必选 | 约束 | 说明 |
|---|---|---|---|---|
| » message | string | true | none | 返回信息 |
| » result | [object] | true | none | 返回结果 |
| »» 属性值 | - | false | none | 属性值 |
| » status | integer | true | none | 响应状态码 |
| » timestamp | integer | true | none | 时间戳 |
响应状态码
| 状态码 | 状态码含义 | 说明 |
|---|---|---|
| 200 | OK | 成功 |
| 401 | Unauthorized | 登录状态已过期,token不能为空 |
| 500 | Internal Server Error | 服务器内部异常 |
Body示例
json
{
"Location": "4F_001",
"ProductID": "1688854025454927872",
"OperCode": {
"Switch": "1",
"Temperature": 29
}
}{
"Location": "4F_001",
"ProductID": "1688854025454927872",
"OperCode": {
"Switch": "1",
"Temperature": 29
}
}- Switch:开关标识,0表示关闭,1表示开启
- Temperature:温度
返回示例
200 Response
说明:响应状态码200,仅代表命令已发送到边缘设备,不代表边缘设备已执行命令。
json
{
"message": "Message sent to device, processing...",
"result": "Message sent to device, processing...",
"status": 200,
"code": "request_handling",
"timestamp": 1692240175079
}{
"message": "Message sent to device, processing...",
"result": "Message sent to device, processing...",
"status": 200,
"code": "request_handling",
"timestamp": 1692240175079
}- 401 Response(鉴权失败,token已过期)
json
{
"message": "Login has expired",
"result": {
"text": "Login has expired",
"value": "expired"
},
"status": 401,
"code": "unauthorized",
"timestamp": 1692240964743
}{
"message": "Login has expired",
"result": {
"text": "Login has expired",
"value": "expired"
},
"status": 401,
"code": "unauthorized",
"timestamp": 1692240964743
}