设备管理API-V1
获取网关列表
GET
{host}/1.0/lists/gateway
获取网关的列表信息
Query Parameters
Name
Type
Description
offset
number
当前页码,从1开始,默认为1
length
string
每页获取的数量,默认为20
{
"code": "0",
"data": {
"page": {
"count": "8"
},
"list": [
{
"dev_eui": "2CF7F11113500001",
"dev_name": "2CF7F11113500001_gateway",
"org_id": "1411841915123",
"position_source": "1",
"dev_country": "",
"frequency": "920",
"device_network": "1",
"position": {
"lon": "113.926979",
"lat": "22.573724"
},
"description": "",
"reg_time": "1567041885000",
"bind_time": "1571208951000",
"latestmsg_time": "0",
"online_status": "0"
}
]
}
}
请求示例
curl --request GET \
--url {host}/1.0/lists/gateway?offset=1&length=2 \
--user '<username>:<password>'
获取网关详情
GET
{host}/1.0/gateway/:gateway_eui
获取指定网关的详情信息
Path Parameters
Name
Type
Description
gateway_eui
string
设备唯一标识
{
"code": "0",
"data": {
"frequency": "470", // frequency
"dev_eui": "2CF7F11213200000", // gateway EUI, equipment unique identity
"dev_name": "2CF7F11014300001", // gateway name
"dev_country": "China", // name country, defined by customer
"device_network": "1",
"description": "a gateway for test", // desc something
"position": { // geographic
"lon": "113.926979",
"lat": "22.573724"
},
"position_source": "0",
"reg_time": "1565313100000", // when the customer activates the device, unit milliseconds
"bind_time": "0", // the gateway bind time, unit milliseconds
"dev_area": "Asia", // gateway area, Europe America Asia
"latestmsg_time": "0", // the latest message time, unit milliseconds
"online_status": "0" // 1 online, 0 offline
}
}
请求示例
curl --request GET \
--url {host}/1.0/gateway/:gateway_eui \
--user '<username>:<password>'
获取节点列表
GET
{host}/1.0/lists/node
获取节点的列表
Query Parameters
Name
Type
Description
length
string
每页获取的数量,默认为20
offset
string
当前页码,从1开始,默认为1
{
"code": "0",
"data": {
"page": {
"count": "84" // total number
},
"list": [
{
"dev_eui": "2CF7F1201350001A", // node EUI, equipment unique identity
"dev_name": "2CF7F1201350001A", // node name
"org_id": "1411841915123",
"position_source": "0",
"dev_country": "American Samoa", // name country, defined by customer
"frequency": "868", // frequency
"device_network": "1",
"description": "21111", // desc something
"reg_time": "1567041874000",
"bind_time": "1571209669000",
"group_unique_name": "00452831720DCA8A",
"position": {
"lat": "26.15868",
"lon": "111.304984"
},
"latestmsg_time": "0", // the latest message time, unit milliseconds
"online_status": "0", // 1 online, 0 offline
"battery_status": "1", // 1 node battery for good, 0 node battery for bad
"group_name": "22"
}
]
}
}
请求示例
curl --request GET \
--url {host}/1.0/lists/node?offset=1&length=2 \
--user '<username>:<password>'
获取节点详情
GET
{host} /1.0/node/:node_eui
获取指定节点的详情
Path Parameters
Name
Type
Description
node_eui
string
设备唯一标识
{
"code": "0",
"data": {
"frequency": "AS470-510",
"dev_eui": "2CF7F16221200060",
"dev_name": "2CF7F12010700002",
"dev_country": "",
"description": "",
"reg_time": "1584528155000",
"dev_area": "Asia",
"latestmsg_time": "1587366392944",
"online_status": "0",
"battery_status": "1",
"group_name": "",
"activate_time": "0",
"sensors": [
{
"sensor_eui": "0111006221200060",
"sensor_channel": "11",
"sensor_type": "2001",
"sensor_measure": [
{
"id": "4097"
}
]
}
]
}
}
请求示例
curl --request GET \
--url {host}/1.0/node/:node_eui \
--user '<username>:<password>'
获取传感器测量值列表
GET
{host} /1.0/lists/sensor/measure
获取所有传感器的物理测量值列表,同时你也可以在附录 - 传感器类型表中查看到这个信息。
{
"code": "0",
"data": [
{
"sensor_id": "1001",
"sensor_name": "SenseCAP AirTemp&Humi Sensor",
"sensor_measure": [
{
"measure_id": "4097",
"measure_name": "Air Temperature",
"measure_unit": "℃"
},
{
"measure_id": "4098",
"measure_name": "Air Humidity",
"measure_unit": "%RH"
}
]
},
{
"sensor_id": "1003",
"sensor_name": "SenseCAP Light Sensor",
"sensor_measure": [
{
"measure_id": "4099",
"measure_name": "Light",
"measure_unit": "Lux"
}
]
},
{
"sensor_id": "1004",
"sensor_name": "SenseCAP CO2 Sensor",
"sensor_measure": [
{
"measure_id": "4100",
"measure_name": "CO2",
"measure_unit": "ppm"
}
]
},
{
"sensor_id": "1005",
"sensor_name": "SenseCAP Air Pressure Sensor",
"sensor_measure": [
{
"measure_id": "4101",
"measure_name": "Air Pressure",
"measure_unit": "Pa"
}
]
},
{
"sensor_id": "1006",
"sensor_name": "SenseCAP Soil Temp&Humi Sensor",
"sensor_measure": [
{
"measure_id": "4102",
"measure_name": "Soil Temperature",
"measure_unit": "℃"
},
{
"measure_id": "4103",
"measure_name": "Soil Humidity",
"measure_unit": "%RH"
}
]
},
{
"sensor_id": "1008",
"sensor_name": "SenseCAP Wind Direction Sensor",
"sensor_measure": [
{
"measure_id": "4104",
"measure_name": "Wind Direction",
"measure_unit": "°"
}
]
},
{
"sensor_id": "1009",
"sensor_name": "SenseCAP Wind Speed Sensor",
"sensor_measure": [
{
"measure_id": "4105",
"measure_name": "Wind Speed",
"measure_unit": "m/s"
}
]
},
{
"sensor_id": "100A",
"sensor_name": "SenseCAP Water PH",
"sensor_measure": [
{
"measure_id": "4106",
"measure_name": "Water PH",
"measure_unit": "PH"
}
]
},
{
"sensor_id": "100B",
"sensor_name": "SenseCAP Light quantum",
"sensor_measure": [
{
"measure_id": "4107",
"measure_name": "Light quantum",
"measure_unit": "umol/㎡s"
}
]
},
{
"sensor_id": "100C",
"sensor_name": "SenseCAP Electrical Conductivity",
"sensor_measure": [
{
"measure_id": "4108",
"measure_name": "Electrical Conductivity",
"measure_unit": "dS/m"
}
]
},
{
"sensor_id": "100D",
"sensor_name": "SenseCAP Dissolved Oxygen",
"sensor_measure": [
{
"measure_id": "4109",
"measure_name": "Dissolved Oxygen",
"measure_unit": "mg/L"
}
]
},
{
"sensor_id": "100E",
"sensor_name": "SenseCAP Soil VWC&EC&Temp Sensor",
"sensor_measure": [
{
"measure_id": "4110",
"measure_name": "Soil Volumetric Water Content",
"measure_unit": "%"
},
{
"measure_id": "4111",
"measure_name": "Soil Electrical Conductivity",
"measure_unit": "dS/m"
},
{
"measure_id": "4112",
"measure_name": "Soil Temperature",
"measure_unit": "℃"
}
]
},
{
"sensor_id": "1011",
"sensor_name": "SenseCAP Rainfall Recorder",
"sensor_measure": [
{
"measure_id": "4113",
"measure_name": "Rainfall Hourly",
"measure_unit": "mm/hour"
}
]
}
],
"time": 0.138
}
请求示例
curl --request GET \
--url {host}/1.0/lists/sensor/measure \
--user '<username>:<password>' \
校验设备eui和code
POST
{host}/1.0/device/check_eui
校验设备的eui和code是否匹配,用于设备绑定前的校验
Request Body
Name
Type
Description
code
string
设备code
eui
string
设备eui
{
"code": "0",
"data": {
"check": "1" // 0-校验失败,1-检验通过
},
"time": 0.261
}
请求示例
curl --request POST \
--url '{host}/1.0/device/check_eui' \
--user '<username>:<password>' \
--header 'content-type: application/x-www-form-urlencoded' \
--data '{"code":"device code","eui":"device eui"}' \
--include
绑定设备
POST
{host}/1.0/device/bind
将设备绑定到账户下
Request Body
Name
Type
Description
eui
string
设备eui
code
string
设备code
device_name
string
设备名称
group_unique_name
string
群组unique_name,可通过群组列表接口获取
lon
string
设备位置,经度
lat
string
设备位置,纬度
{
"code": "0",
"data": {},
"time": 0.261
}
请求示例
curl --request POST \
--url '{host}/1.0/device/bind' \
--user '<username>:<password>' \
--header 'content-type: application/x-www-form-urlencoded' \
--data '{"code":"device code","eui":"device eui"}' \
--include
Last updated
Was this helpful?