离线测点信息上报

根据模型中的输入参数和输出参数来配置下列的参数。如果请求中部分数据发送失败,整个请求全部发送失败,返回第一个出现的错误码。

上行

  • 请求TOPIC: sys/${productKey}/integration/measurepoint/post
  • 响应TOPIC: sys/${productKey}/integration/measurepoint/post_reply

请求数据格式

{
    "id":"123",
    "version":"1.0",
    "params":[
        {
            "deviceKey":"device1",
            "measurepoints":{
                "Power":{
                    "value":1,
                    "quality":9
                },
                "temp":1.02,
                "branchCurr":[
                    "1.02",
                    "2.02",
                    "7.93"
                ]
            },
            "time":123456
        },
        {
            "deviceKey":"device1",
            "measurepoints":{
                "Power":{
                    "value":2,
                    "quality":9
                },
                "temp":2.02,
                "branchCurr":[
                    "2.02",
                    "3.02",
                    "9.93"
                ]
            },
            "time":123567
        },
        {
            "deviceKey":"device2",
            "measurepoints":{
                "Power":{
                    "value":1,
                    "quality":9
                },
                "temp":1.02,
                "branchCurr":[
                    "1.02",
                    "2.02",
                    "7.93"
                ]
            },
            "time":123456
        }
    ],
    "method":"integration.measurepoint.post"
}

响应数据格式

{
    "id": "123",
    "code": 200,
    "data": {}
}

参数说明

参数 类型 是否必需 描述
id String 可选 消息 ID 号,保留值
version String 必需 协议版本号,目前协议版本1.0
params Object 必需 上报测点所需的参数
deviceKey String 可选 设备的device key
measurepoints Object 必需 需上报的测点的标识符的列表
power String 可选 要上报的测点的标识符,在此示例中为属性 power 的标识符。此处设置的格式必须与服务的数据类型匹配。例如,当此参数的数据类型在模型中设置为struct时,此处的格式必须与模型中保持一致,此示例中为 valuequality
value Integer 可选 该测点的成员的名称。在本例中,为参数 value 。此处设置的值必须与服务的数据类型匹配
quality Integer 可选 该测点的标识符。在本例中,为参数 quality 。此处设置的值必须与服务的数据类型匹配
temp String 可选 要上报的测点的标识符,在此示例中为属性 temp 的标识符。此处设置的值必须与服务的数据类型匹配
branchCurr String 可选 要上报的测点的标识符,在此示例中为属性 branchCurr 的标识符。如上,此处设置的值必须与服务的数据类型匹配
time Timestamp 必需 测点的时间戳。
method String 必需 请求方法
code Integer 必需 结果返回码。200代表请求成功执行
data JSON 可选 返回的详细信息。JSON格式

结果返回码

返回码 错误信息 释义
1204 Model validate failed 数据格式不符合模型定义
1257 Device not found 设备不存在