NB-IoT物联网套件 产品介绍 快速入门 用户指南 设备开发指南 应用开发指南 NB设备远程升级 最佳实践 常见问题 服务协议 更新日志 接入地址列表

批量查询设备信息

请求方式:GET

URL: http(s)://api.heclouds.com/devices

我只想看示例!!!

URL参数

参数名称格式是否必须说明
key_wordsstring匹配关键字,从id和title字段中左匹配
auth_infostring鉴权信息
tagarray-string设备标签
onlinebool设备在线状态
privatebool设备私密性
pageint指定页码,最大页数为10000
per_pageint指定每页输出设备个数,默认30,最多100
device_idstring指定设备ID,多个用逗号分隔,最多100个
beginstring起始时间,北京时间,示例:2019-10-01
endstring结束时间,北京时间,示例:2019-10-01

返回参数

参数名称格式说明
errnoint调用错误码,为0表示调用成功
error string错误描述,为"succ"表示调用成功
datajson接口调用成功之后返回的设备相关信息,见data描述表
data描述表
参数名称格式说明
total_countint查询结果中设备的数量
pageint当前页码
per_pageint每页设备数量
devicesarray-json设备信息的json数组,见devices描述表

devices描述表

参数名称格式说明
protocolstring设备接入协议
create_timestring设备创建时间,北京时间
onlinebool设备在线状态
idstring设备ID
auth_infostring设备鉴权信息,对应设备注册接口中的"sn"或者"mac"参数
titlestring设备名
descstring设备描述
tagsarray-string设备标签
locationjson设备位置坐标信息,以经纬度键值对表示:{"lon":xx,"lat":xx}
otherjson其他设备自定义信息,以键值对格式表示,见示例

请求示例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 个搜索结果,搜索内容 “