获取网关列表

GET
{host}/device/list_gateways
获取网关的列表信息
Query Parameters
offset
number
当前页码,从1开始,默认为1
length
string
每页获取的数量,默认为20

返回示例

{
    "code": "0",
    "data": {
        "page": {
            "count": "8"
        },
        "list": [
            {
                "dev_eui": "2CF7F11113500001",
                "dev_name": "2CF7F11113500001_gateway",
                "org_id": "1411841915123",
                "position_source": "1",
                "dev_country": "",
                "frequency": "920",
                "device_network": "1",
                "position": {
                    "lon": "113.926979",
                    "lat": "22.573724"
                },
                "description": "",
                "reg_time": "1567041885000",
                "bind_time": "1571208951000",
                "latestmsg_time": "0",
                "online_status": "0"
            }
        ]
    }
}

请求示例

curl --request GET \
     --url {host}/device/list_gateways?offset=1&length=2 \
     --user '<username>:<password>'

获取节点列表

GET
{host}/device/list_nodes
获取节点的列表
Query Parameters
offset
number
当前页码,从1开始,默认为1
length
string
每页获取的数量,默认为20

返回示例

{
    "code": "0",
    "data": {
        "page": {
            "count": "84"  // total number 
        }, 
        "list": [
            {
                "dev_eui": "2CF7F1201350001A", // node EUI, equipment unique identity
                "dev_name": "2CF7F1201350001A", // node name
                "org_id": "1411841915123",
                "position_source": "0",
                "dev_country": "American Samoa", // name country, defined by customer
                "frequency": "868",    // frequency
                "device_network": "1",
                "description": "21111", // desc something
                "reg_time": "1567041874000",
                "bind_time": "1571209669000",
                "group_unique_name": "00452831720DCA8A",
                "position": {
                    "lat": "26.15868",
                    "lon": "111.304984"
                },
                "latestmsg_time": "0", // the latest message time, unit milliseconds
                "online_status": "0", // 1 online, 0 offline
                "battery_status": "1", // 1 node battery for good, 0 node battery for bad
                "group_name": "22"
            }
        ]
    }
}

请求示例

curl --request GET \
     --url {host}/device/list_nodes?offset=1&length=2 \
     --user '<username>:<password>'

获取网关详情

GET
{host}/device/view_gateway/:eui
获取指定网关的详情信息
Path Parameters
gateway_eui
(required)
string
设备唯一标识

返回示例

{
    "code": "0",
    "data": { 
        "frequency": "470",  // frequency
        "dev_eui": "2CF7F11213200000", // gateway EUI, equipment unique identity
        "dev_name": "2CF7F11014300001", // gateway name
        "dev_country": "China",  // name country, defined by customer
        "device_network": "1",
        "description": "a gateway for test", // desc something
        "position": {                        // geographic
            "lon": "113.926979",
            "lat": "22.573724"
        },
        "position_source": "0",
        "reg_time": "1565313100000", // when the customer activates the device, unit milliseconds
        "bind_time": "0",   // the gateway bind time, unit milliseconds
        "dev_area": "Asia", // gateway area, Europe America Asia
        "latestmsg_time": "0",  // the latest message time, unit milliseconds
        "online_status": "0"    // 1 online, 0 offline
    }
}

请求示例

curl --request GET \
     --url {host}/device/view_gateway/:eui \
     --user '<username>:<password>'

获取节点详情

GET
{host}/device/node/:eui
获取指定节点的详情
Path Parameters
node_eui
(required)
string
设备唯一标识

返回示例

{
    "code": "0",
    "data": {
        "frequency": "AS470-510",
        "dev_eui": "2CF7F16221200060",
        "dev_name": "2CF7F12010700002",
        "dev_country": "",
        "description": "",
        "reg_time": "1584528155000",
        "dev_area": "Asia",
        "latestmsg_time": "1587366392944",
        "online_status": "0",
        "battery_status": "1",
        "group_name": "",
        "activate_time": "0",
        "sensors": [
            {
                "sensor_eui": "0111006221200060",
                "sensor_channel": "11",
                "sensor_type": "2001",
                "sensor_measure": [
                    {
                        "id": "4097"
                    }
                ]
            }
        ]
    }
}

请求示例

curl --request GET \
     --url {host}/device/node/:eui \
     --user '<username>:<password>'

获取传感器测量值列表

GET
{host}/sensor/measurements
获取所有传感器的物理测量值列表,同时你也可以在附录 - 传感器类型表中查看到这个信息。

返回示例

{
    "code": "0",
    "data": [
        {
            "sensor_id": "1001",
            "sensor_name": "SenseCAP AirTemp&Humi Sensor",
            "sensor_measure": [
                {
                    "measure_id": "4097",
                    "measure_name": "Air Temperature",
                    "measure_unit": "℃"
                },
                {
                    "measure_id": "4098",
                    "measure_name": "Air Humidity",
                    "measure_unit": "%RH"
                }
            ]
        },
        ...
    ]
}

请求示例

curl --request GET \
     --url {host}/sensor/measurements \
     --user '<username>:<password>' \

获取传感器测量值列表-V2

GET
{host}/list_measurement_reference
获取所有传感器的物理测量值列表,同时你也可以在附录 - 传感器类型表中查看到这个信息。

响应

字段名称 说明
sensor_type 传感器类型
sensor_name 传感器名称
measurement_id 测量值id
measurement_name 测量值名称
measurement_unit 测量值单位

请求示例

curl --request GET \
     --url {host}/list_measurement_reference \
     --user '<username>:<password>' \

{
    "code": "0",
    "data": [
        {
            "sensor_type": "1001",
            "sensor_name": "SenseCAP AirTemp&Humi Sensor",
            "sensor_measurement": [
                {
                    "measurement_id": "4097",
                    "measurement_name": "Air Temperature",
                    "measurement_unit": "℃"
                },
                {
                    "measurement_id": "4098",
                    "measurement_name": "Air Humidity",
                    "measurement_unit": "%RH"
                }
            ]
        },
        ...
    ]
}

校验设备eui和code

POST
{host}/sensor/measurements
校验设备的eui和code是否匹配,用于设备绑定前的校验
Body Parameters
eui
(required)
string
设备eui
code
(required)
string
设备code

返回示例

{
    "code": "0",
    "data": {
        "check": "1"  // 0-校验失败,1-检验通过
    }
}

请求示例

curl --request POST \
     --url '{host}/sensor/measurements' \
     --user '<username>:<password>' \
     --header 'Content-Type: application/json; charset=utf-8' \
     --data '{"code":"device code","eui":"device eui"}' \
     --include

绑定设备

POST
{host}/device/bind
将设备绑定到账户下
Body Parameters
eui
(required)
string
设备eui
code
(required)
string
设备code
device_name
string
设备名称
group_unique_name
string
群组unique_name,可通过群组列表接口获取
lon
string
设备位置,经度
lat
string
设备位置,纬度

返回示例

{
    "code": "0",
    "data": {}
}

请求示例

curl --request POST \
     --url '{host}/device/bind' \
     --user '<username>:<password>' \
     --header 'Content-Type: application/json; charset=utf-8' \
     --data '{"code":"device code","eui":"device eui"}' \
     --include