Multiprotocol Access Product Introduction QuickStart User Guide Development Guide
EDP TCP transparent transmission MQTT Modbus HTTP
FAQ

Batch query of device information

Request format: GET

URL: http://api.onenet.hk.chinamobile.com/devices

URL Parameters

Name Format Required or not Description
key_words string No Matching keyword on the left of the id and title fields
auth_info string No Authentication information
tag array- string No Device tag
online bool No Device online status
private bool No Device privacy
page int No Specify the page number, max. 10000
per_page int No Specify the number of output devices per page, 30 by default and max. 100
device_id string No Specify the device ID, separated by commas, max. 100
begin string No Beginning time, Beijing time. Example: 2016-06-20
end string No End time, Beijing time. Example: 2016-06-20

Return Parameters

Name Format Description
errno int Call error code, where 0 means success.
error string Error description. “succ” means the call is successful.
data json Device-related information returned after interface is successfully called. See the Data Description Table.
Data Description Table
Name Format Description
total_count int Number of devices in the query result
page int Current page
per_page int Number of devices per page
devices array- json Json array of device information. See the description table of devices.
Description table of devices
Name Format Description
protocol string Device access protocol
create_time string Device creation time, Beijing time
online bool Device online status
id string Device ID
auth_info string Device authentication information, corresponding to the “sn” or “mac” parameter in the device registration interface
title string Device name
desc string Device description
tags array- string Device tag
location json Coordinates of the device location, expressed as a longitude and latitude key-value pair: {“lon”:xx, “lat”:xx}
other json Other custom information of the device, in the key-value pair format. See the example.

Request Example 1

Query online devices (tag: china) created from February 4, 2017 to June 4, 2017

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

Request Example 2

Query two devices with the device ID 35282992 and 35271941

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

Request Example 3

Query all devices under this product

GET http://api.onenet.hk.chinamobile.com/devices HTTP/1.1

Return Example

{
    "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 个搜索结果,搜索内容 “