创建新设备组

POST
{host}/group/create_group
此功能用于创建新设备组,上限为50组。
Body Parameters
name
(required)
string
自定义组名称

返回示例

{
    "code": "0",
    "data": {
        "org_id": "1411841915123",
        "name": "test group22",
        "unique_name": "1B86514936880D18",
        "created": "1587690584174"
    }
}

请求示例

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

获取设备组列表

GET
{host}/group/list_group_nodes
获取所有设备组

返回示例

{
    "code": "0",
    "data": [
        {
            "group_name": "Default",
            "group_unique_name": "",
            "nodes": [
                {
                    "dev_eui": "2CF7F12003900000",
                    "dev_name": "TEST",
                    "lon": "113.9291658",
                    "lat": "22.5710348",
                    "online_status": "0",
                    "battery_status": "2"
                },
                {
                    "dev_eui": "2CF7F12104700011",
                    "dev_name": "US915-2CF7F12104700011",
                    "lon": "113.926979",
                    "lat": "22.573724",
                    "online_status": "0", // "0"表示设备离线,“1”表示设备在线
                    "battery_status": "2" // "0"表示电池低电量,“1”表示电池电量正常
                }
            ]
        },
        {
            "group_name": "demo",
            "group_unique_name": "00452831720DCA8A",
            "nodes": [
                {
                    "dev_eui": "2CF7F1201350001A",
                    "dev_name": "2CF7F1201350001A",
                    "lon": "111.304984",
                    "lat": "26.15868",
                    "online_status": "0",
                    "battery_status": "2"
                }
            ]
        }
    ]
}

请求示例

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

获取设备组和组内的设备列表

GET
{host}/group/list_group_statistic
获取所有的组以及每个组内的设备。

其中有一个默认组是虚拟组,他的group_unique_name为空。所有的设备绑定时如果未指定组,将会默认分配到默认组中,之后可以用户可以自由分配设备到其他组中。

返回示例

{
    "code": "0",
    "data": {
        "page": {
            "count": "12"
        },
        "list": [
            {
                "name": "Default",
                "group_unique_name": "",
                "created": "0",
                "dev_cnt": "62",
                "online_cnt": "1"
            },
            {
                "created": "1553573458000",
                "name": "雅安茶园",
                "group_unique_name": "52975E5A7C2C396A",
                "dev_cnt": "7",
                "online_cnt": "0"
            }
        ]
    }
}

请求示例

curl --request GET \
     --url '{host}/group/list_group_statistic' \
     --user '<username>:<poassword>' \
     --header 'content-type: application/json' \
     --include