[NB-IoT物聯網套件] 產品介紹 快速入門 用戶指南 設備開發指南 應用開發指南 最佳實踐 常見問題 服務協議 變更日誌

批量查詢設備信息

請求方式:GET

URL: http(s)://api.onenet.hk.chinamobile.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.onenet.hk.chinamobile.com/devices?begin=2017-02-04&end=2017-06-04&online=true&tag=china HTTP/1.1

請求示例2

查詢設備ID為35282992,35271941的兩個設備:

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

請求示例3

查詢該產品下所有的設備:

GET http://api.onenet.hk.chinamobile.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 个搜索结果,搜索内容 “