Skip to content

调用控制器控制边缘设备功能 (POST)

更新时间:

请求接口

POST /api/device/invoked/{deviceId}/function/{functionId}

TIP

访问权限:需要登录超级设备管理平台获取token,并校验token

请求参数

名称位置类型必选说明
X-Access-Tokenheaderstringtrue平台 token
deviceIdpathstringtrue控制器设备ID
functionIdpathstringtrue功能标识,为固定值DeviceCtrl
Locationbodystringtrue边缘设备所在位置
ProductIDbodystringtrue边缘设备所属产品ID
OperCodebodyobjecttrue操作编码
»属性1bodystringtrue填入相应的属性
»属性2bodyintegertrue温度

响应参数

以200 Response为例,响应参数如下:

名称类型必选约束说明
» messagestringtruenone返回信息
» result[object]truenone返回结果
»» 属性值-falsenone属性值
» statusintegertruenone响应状态码
» timestampintegertruenone时间戳

响应状态码

状态码状态码含义说明
200OK成功
401Unauthorized登录状态已过期,token不能为空
500Internal 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
}