设备数据API-V1

获取设备EUI列表

GET {host}/1.0/lists/devices/eui

这是一个获取组织账号下所有设备EUI的便捷方法。

{
    "code": "0",
    "data": {
        "gateway": [
            "2CF7F1........",
            "2CF7F1........",
            "2CF7F1........"
        ],
        "node": [
            "2CF7F1........",
            "2CF7F1........",
            "2CF7F1........",
            "2CF7F1........",
            "2CF7F1........"
        ]
    }
}

请求示例

curl --request GET \
  --url {host}/1.0/lists/devices/eui \
  --user '<username>:<password>'

获取设备最新数据

GET {host}/1.0/devices/data/:node_eui/latest

返回设备最新的一条遥测数据

Path Parameters

NameTypeDescription

node_eui

string

节点设备唯一标识

Query Parameters

NameTypeDescription

measure_id

string

传感器的测量值ID

channel

string

返回该通道下的测量值,如果不传参则默认返回所有通道的测量值

{
    "code": "0",
    "data": [
        {
            "channel": "32", // channel number
            "points": [
                {
                    "value": "185", // the measurement value
                    "measurement_id": "4104", // the measurement id
                    "created": "1585207708575" // when the record is created 
                }
            ]
        }
    ]
}

请求示例

curl --request GET \
     --url {host}/1.0/devices/data/:node_eui/latest?measure_id:measure_id&channel:channel \
     --user '<username>:<password>' \
     --include

获取设备历史数据

GET {host}/1.0/devices/data/:node_eui/raw

获取指定传感器节点设备的历史数据,最多返回一个月范围的数据。

Path Parameters

NameTypeDescription

node_eui

string

节点设备唯一标识

Query Parameters

NameTypeDescription

measure_id

string

传感器的测量值ID

channel

string

返回该通道下的测量值,如果不传参则默认返回所有通道的测量值

limit

string

要查询的记录条数,最多400条

time_start

string

时间戳,单位是毫秒

time_end

string

时间戳,单位是毫秒

{
    "code": "0",
    "data": [
        {
            "channel": "1", // channale number
            "points": [
                {
                    "measurement_id": "4099", // the measurement id
                    "value": "0",  // measurement value
                    "created": "1585207694901" // when the record is created 
                },
                {
                    "measurement_id": "4099",
                    "value": "0",
                    "created": "1585207626265"
                }
            ],
            "channel_name": ""
        },
        {
            "channel": "2",
            "points": [
                {
                    "measurement_id": "4102",
                    "value": "25.7",
                    "created": "1585207695572"
                },
                {
                    "measurement_id": "4103",
                    "value": "0.0",
                    "created": "1585207695572"
                }
            ],
            "channel_name": ""
        }
    ]
}

请求示例

curl --request GET \
  --url {host}/1.0/devices/data/:node_eui/raw?limit=:limit&time_start=:time_start&time_end=:time_end \
  --user '<username>:<password>' \
  --include

获取设备数据段

GET {host}/1.0/devices/data/:node_eui/segment

将庞大的数据段分成小数据段,然后输出每个小段的平均值。用时间长度描述小段,例如:60分钟。

Path Parameters

NameTypeDescription

node_eui

string

节点设备唯一标识

Query Parameters

NameTypeDescription

measure_id

string

传感器的测量值ID

channel

string

返回该通道下的测量值,如果不传参则默认返回所有通道的测量值

segment

string

要获取的时间段长度,以分钟为单位

time_start

string

时间戳,单位是毫秒

time_end

string

时间戳,单位是毫秒

{
    "code": "0",
    "data": [
        {
            "channel": "1", // channel number
            "lists": [
                {
                    "avg": "9.72",  // avgrage value of the segment
                    "measurement_id": "4099", // the measurement id
                    "created": "1556051760000"
                },
                {
                    "avg": "6.07",
                    "measurement_id": "4099",
                    "created": "1556177940000"
                }
            ]
        }
    ]
}

请求示例

curl --request GET \
  --url {host}/1.0/devices/data/:node_eui/segment?measure_id:measure_id&channel:channel&segment:segment&time_start:time_start&time_end:time_end \
  --user '<username>:<password>' \
  --include

Last updated