多协议接入 产品介绍 快速入门 用户指南 开发指南
接入地址 API返回码说明 EDP TCP透传 MQTT Modbus HTTP

批量查询设备信息

请求方式:GET

URL: http://api.heclouds.com/devices

URL参数

参数名称 格式 是否必须 说明
key_words string 匹配关键字,从id和title字段中左匹配
auth_info string 鉴权信息
tag array-string 设备标签
online bool 设备在线状态
private bool 设备私密性
page int 指定页码,最大页数为10000
per_page int 指定每页输出设备个数,默认30,最多100
device_id string 指定设备ID,多个用逗号分隔,最多100个
begin string 起始时间,北京时间,示例:2016-06-20
end string 结束时间,北京时间,示例:2016-06-20

返回参数

参数名称 格式 说明
errno int 调用错误码,为0表示调用成功
error string 错误描述,为"succ"表示调用成功
data json 接口调用成功之后返回的设备相关信息,见data描述表
data描述表
参数名称 格式 说明
total_count int 查询结果中设备的数量
page int 当前页
per_page int 每页设备数量
devices array-json 设备信息的json数组,见devices描述表
devices描述表
参数名称 格式 说明
protocol string 设备接入协议
create_time string 设备创建时间,北京时间
online bool 设备在线状态
id string 设备ID
auth_info string 设备鉴权信息,对应设备注册接口中的"sn"或者"mac"参数
title string 设备名
desc string 设备描述
tags array-string 设备标签
location json 设备位置坐标信息,以经纬度键值对表示:{"lon":xx,"lat":xx}
other json 其他设备自定义信息,以键值对格式表示,见示例

请求示例1

查询创建时间为2017-02-04至2017-06-04的标签为china的在线设备

GET http://api.heclouds.com/devices?begin=2017-02-04&end=2017-06-04&online=true&tag=china HTTP/1.1

请求示例2

查询设备ID为35282992,35271941的两个设备

GET http://api.heclouds.com/devices?device_id=35282992,35271941 HTTP/1.1

请求示例3

查询该产品下所有的设备

GET http://api.heclouds.com/devices HTTP/1.1

返回示例

{
    "errno": 0,
    "data": {
        "per_page": 30,
        "devices": [{
            "protocol": "EDP",
            "other": {
                "version": "1.0.0",
                "manufacturer": "china mobile"
            },
            "create_time": "2018-06-04 17:43:11",
            "online": true,
            "location": {
                "lat": 23.54,
                "lon": 109
            },
            "id": "35282992",
            "auth_info": "tes01235n82105",
            "title": "test_device",
            "desc": "test_desc",
            "tags": ["china", "mobile"]
        }, {
            "protocol": "EDP",
            "create_time": "2018-06-04 11:15:38",
            "online": true,
            "id": "35271941",
            "auth_info": "tes810372105",
            "title": "test_device",
            "tags": ["china"]
        }],
        "total_count": 2,
        "page": 1
    },
    "error": "succ"
}

个搜索结果,搜索内容 “

    0 个搜索结果,搜索内容 “