請求方式:GET
URL: http://api.onenet.hk.chinamobile.com/devices
參數名稱 | 格式 | 是否必須 | 說明 |
---|---|---|---|
key_words | string | 否 | 匹配關鍵字,從id和title欄位中左匹配 |
auth_info | string | 否 | 鑒權信息 |
tag | array-string | 否 | 設備標籤 |
online | bool | No | 設備在線狀態 |
private | bool | No | 設備私密性 |
page | int | No | 指定頁碼,最大頁數為10000 |
per_page | int | No | 指定每頁輸出設備個數,預設30,最多100 |
device_id | string | 否 | 指定設備ID,多個用逗號分隔,最多100個 |
begin | string | 否 | 起始時間,北京時間,示例:6/20/2016 |
end | string | 否 | 結束時間,北京時間,示例:6/20/2016 |
參數名稱 | 格式 | 說明 |
---|---|---|
errno | int | 調用錯誤碼,為0表示調用成功 |
error | string | 錯誤描述,為“succ”表示調用成功 |
data | json | 介面調用成功之後返回的設備相關信息,見data描述表 |
參數名稱 | 格式 | 說明 |
---|---|---|
total_count | int | 查詢結果中設備的數量 |
page | int | 當前頁 |
per_page | int | 每頁設備數量 |
devices | array-json | 設備信息的json陣列,見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 | 其他設備自訂信息,以鍵值對格式表示,見示例 |
查詢創建時間為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
查詢設備ID為35282992,35271941的兩個設備
GET http://api.onenet.hk.chinamobile.com/devices?device_id=35282992,35271941 HTTP/1.1
查詢該產品下所有的設備
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"
}