device-docking/爱牵挂/爱牵挂M1对外API/device.md
2023-12-20 11:07:38 +08:00

1855 lines
53 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

如果是post请求把参数带到body里面禁止写到URL后面。URL后面带参数的全是get请求。 我们的测试服虽然get和post请求都可以使用但是要是用规范改post请求的时候必须post请求并且把参数放到body下不要放到URL后面。我们的正式服因为换过架构所以会更加规范修改接口必须是post且放到body下进行请求
设备信息
========
# 查看指定设备
- 地址: /api/device/[device id]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [device](./object.md#device)
- URL参数: device id
- 请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/device/868219000099926
- 响应范例
{
"obj": {
"_id": "866815030630127",
"alerts": [
{
"seqid": 1,
"enable": true,
"voice_type": "0",
"reply_enable": false,
"name": "运动",
"alert_type": 1,
"cycle": 2,
"time": "20201021102800",
"media_length": 4966,
"file_checksum": 0,
"filename": "1.amr",
"url": "/media/alerts/866815030630127/1.amr",
"created_at": {
"$date": 1603275642000
}
},
{
"seqid": 2,
"enable": true,
"voice_type": "0",
"reply_enable": true,
"name": "糖尿病药",
"alert_type": 1,
"cycle": 2,
"time": "20201021143928",
"media_length": 5798,
"file_checksum": 0,
"filename": "2.amr",
"url": "/media/alerts/866815030630127/2.amr"
},
{
"seqid": 3,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 4,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 5,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 6,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 7,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 8,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 9,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
},
{
"seqid": 10,
"enable": false,
"voice_type": "",
"reply_enable": false,
"name": "",
"alert_type": 1,
"cycle": 1,
"time": "",
"media_length": 0,
"file_checksum": 0
}
],
"sos_numbers": [
{
"seqid": 1,
"name": "陈文声",
"num": "+8618302075248",
"dial_flag": true
},
{
"seqid": 2,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 3,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 4,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 5,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 6,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 7,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 8,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 9,
"name": "",
"num": "",
"dial_flag": false
},
{
"seqid": 10,
"name": "",
"num": "",
"dial_flag": false
}
],
"tool_numbers": [
{
"seqid": 1,
"name": "",
"num": ""
},
{
"seqid": 2,
"name": "",
"num": ""
},
{
"seqid": 3,
"name": "",
"num": ""
},
{
"seqid": 4,
"name": "",
"num": ""
},
{
"seqid": 5,
"name": "",
"num": ""
}
],
"sos_dial_cycle_times": 1,
"sos_sendmail": false,
"sos_readmail": false,
"frequency_location": 5,
"frequency_step": 30,
"frequency_heartrate": 30,
"theshold_heartrate_h": 140,
"theshold_heartrate_l": 40,
"heartrate_enable": true,
"incoming_restriction": false,
"bluetooth_enable": false,
"bluetooth_devices": "",
"profile": 3,
"sleep_period_begin": "00000000220000",
"sleep_period_end": "00000000060000",
"step_objective": 5000,
"theshold_sit": 60,
"theshold_low_battery": 15,
"fall_enable": false,
"fall_model": 0,
"fences": [
{
"seqid": 1,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 2,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 3,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 4,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 5,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 6,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 7,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 8,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 9,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
},
{
"seqid": 10,
"freq": true,
"enable": false,
"name": "",
"time_begin": 0,
"time_end": 0
}
],
"pedometer_enable": true,
"sleep_enable": true,
"service_number": "",
"sos_dial_cycle_mode": 0,
"track_enable": true,
"power_down_enable": false,
"home_wifi_addr": "",
"home_wifi_ssid": "",
"systolic_pressure": 70,
"diastolic_pressure": 120,
"short_message_enable": true,
"callmode": 0,
"dormancy_enable": false,
"time_system": 0,
"lang": 1,
"timezone": 8,
"dnds": [
{
"seqid": 1,
"cycle": 0,
"time_begin": 0,
"time_end": 0
},
{
"seqid": 2,
"cycle": 0,
"time_begin": 0,
"time_end": 0
},
{
"seqid": 3,
"cycle": 0,
"time_begin": 0,
"time_end": 0
},
{
"seqid": 4,
"cycle": 0,
"time_begin": 0,
"time_end": 0
},
{
"seqid": 5,
"cycle": 0,
"time_begin": 0,
"time_end": 0
}
],
"udtime_begin": 21600,
"udtime_end": 79200,
"frequency_sedentary": 0,
"frequency_temperature": 60,
"temperature_enable": false,
"theshold_temperature_h": 37.3,
"theshold_temperature_l": 35.0,
"gps_enable": false,
"bloodpressure_enable": true,
"bloodoxygen_enable": true,
"alertreply_enable": true,
"theshold_bloodoxygen_h": 99,
"theshold_bloodoxygen_l": 93,
"wifi_connect_enable": true,
"imei": "866815030630127",
"imsi": "",
"type": "X1",
"sim_phone": "18838030850",
"sim_phone_type": "cmcc",
"owner": {
"$oid": "5f8eae282642510b4bd152f5"
},
"name": "X1-27",
"created_at": {
"$date": 1603204993802
},
"updated_at": {
"$date": 1603292773883
},
"lastlogin_ip": "112.96.164.159",
"lastlogin_at": {
"$date": 1603292773883
},
"active": true,
"active_at": {
"$date": 1603211828000
},
"end_at": {
"$date": 1634688000000
},
"online": true,
"statu": "",
"location_updated": true,
"location_updated_at": {
"$date": 1603291252342
},
"last_location": {
"type": "Point",
"coordinates": [
113.4566648,
23.1672477
]
},
"last_city": "广州市",
"city_code": "440112",
"last_province": "广东省",
"last_address": "广东省 广州市 黄埔区 观虹路 靠近平安银行(广州科学城科技支行)",
"home_location": {
"type": "Point",
"coordinates": [
0,
0
]
},
"home_address": "",
"location_action_updated_at": {
"$date": 1603279712656
},
"wear_flag": 1,
"wear_updated_at": {
"$date": 1603288817931
},
"remaining_power": 48,
"remaining_power_updated_at": {
"$date": 1603292773898
},
"wifi": [],
"software_version": "ZW001_X1_v008_20201014",
"iccid2": "460078488212074",
"systolic_pressure_h": 140,
"diastolic_pressure_l": 60,
"last_server": "172.18.14.123",
"video_id": "866815030630127",
"connecting_wifi": "",
"network_type": "1"
},
"success": true,
"obj_name": "device"
}
# 修改设备 --M1
- 地址: /api/device/[device oid]/4g/edit/
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: [device](./object.md#device)
- URL参数: device oid
- 请求参数: [device](./object.md#device)
__请求范例__
curl -v -A CURL -b cookies.txt -d "name=ABC" http://127.0.0.1:8000/api/device/868219000099926/4g/edit?step_objective=2000
> POST /api/device/868219000099926/edit?step_objective=2000 HTTP/1.1
> User-Agent: CURL
> Host: 120.24.56.48:8889
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
> Content-Length: 8
> Content-Type: application/x-www-form-urlencoded
__响应范例__
{
"success": true
}
# 设置提醒
报语音提醒的时候会上传答复数据,且和普通语音提醒共数量和编号。 答复开关是在修改配置参数alertreply_enable默认是打开的
#语音播报是按任何键会结束提醒,上传答复数据是已处理
#语音播报超过3分钟没有按任何按键上传的答复数据是未处理。
- 地址: /api/device/[device oid])/4g/alerts/[alert id: 1-5]/
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: 无
- URL参数: device oid
- URL参数: alert id(1-5)
- 请求参数: 至少设置一个参数
| 名称 | 必须 | 类型 | 说明 |
| ------------ | ---- | ------------ | ------------------------------ |
| enable | 否 | Int | 0,1 |
| name | 否 | String | |
| alert_type | 否 | Int | 提醒类型 0 重复 1 仅一次 |
| cycle | 否 | Int | 周期 1 以星期为周期 2 以日期为周期 |
| time | 否 | String | time 预定的响铃时间1、 cycle=1时实例1001101+21+30+
表示从周日、周一……周六的七天响铃的那天为1不响为0时间是21点30分。
2、 cycle=2时时间为YYYYMMDDHHmmSS实例 20150313213000 time的长度固定为14 |
| reply_enable | 否 | int | 答复类型 传0是未反馈预警开关没有打开传1是未反馈预警开关已打开 |
| upfile | 否 | multipart | amr文件 |
| clear | 否 | any | 如果指定clear参数则上述参数全部无意义全部重设为缺省值 |
- 请求范例
curl -v -A CURL -d 'name=1' -b cookies.txt
http://127.0.0.1:8000/api/device/868219000099926/4g/alerts/1?name=1
- 响应范例
{
"success": true
}
# 设置亲情号码
- 地址: /api/device/[device oid]/4g/sos_numbers/[id: 1-10]/
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: 无
- URL参数: device oid
- URL参数: id(1-10)
- 请求参数: 至少设置一个参数
| 名称 | 必须 | 类型 | 说明 |
| ------------ | ---- | ------------ | ------------------------------ |
| name | 否 | String | 号码昵称 |
| num | 否 | String | 亲情号码,可以是手机或固话 |
| dial_flag | 否 | Int | 0不设置为紧急呼叫号码,1设置为紧急呼叫号码 |
| clear | 否 | any | 清空设置,[例如id值为2如果发送的url带clear系统只处理clear命令则上述设置的亲情号2的参数无效若该设备以前存有亲情号码2则以前设置的亲情号码2也会被清空] |
- 请求范例
curl -v -A CURL -d 'name=1' -b cookies.txt
http://127.0.0.1:8000/api/device/868219000099926/4g/sos_numbers/1?name=1
- 响应范例
{
"success": true
}
# 设置安全区域
- 地址: /api/device/[device oid])/4g/fences/[id: 1-10]/
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: 无
- URL参数: device oid
- URL参数: id(1-10)
- 请求参数: 至少设置一个参数设置安全围栏时最好设置全部的参数除了参数clear外该参数是用于清空设置的。修改安全围栏也是调用这个接口
| 名称 | 必须 | 类型 | 说明 |
| ------------ | ---- | ------------ | ------------------------------ |
| enable | 否 | Int | 0,1 |
| name | 否 | String | |
| freq | 否 | Boolean | 0触发一天1每日触发 |
| time_begin | 否 | Int | 目标时间与当日0点之间相差的秒数。如8 a.m 8*60*60=28800 |
| time_end | 否 | Int | 同上 |
| safe_area | 否 | String | 经度在前纬度在后 x1,y1;x2,y2;xn,yn 一组由';'分隔的坐标,坐标用','分隔。且需要呈闭环如A,B,C,D4个点则应该上传的数据为 A;B;C;D;A |
| clear | 否 | any | 如果指定clear参数则上述参数全部无意义全部重设为缺省值 |
- 请求范例
curl -v -A CURL -d 'name=1' -b cookies.txt
http://127.0.0.1:8000/api/device/868219000099926/4g/fences/1?name=1
- 响应范例
{
"success": true
}
# 在线设备操作
合法的action如下
| action | 说明 |
| --------------- | ------------------------------ |
| ring | 响铃 |
| restart | 重启 |
| restore | 恢复出厂 |
| get_envvoice | 获取环境录音 | 无 | DeviceEnvVoice | 录音成功以后,如果配置有对应的分发提醒,会触发|
- 地址: /api/device/[device oid]/4g/action/[action]
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: 无
- URL参数: device oid
# 获取在线设备实时数据
合法的action如下
| action | 说明 | 参数及类型 | 返回对象 |
| ---------------------- | ------------- | ---------- | --------- |
| get_locationdataonce | 获取实时位置 | 无 | 无 | 30秒 (只能发一条定位数据)
| get_heartrate | 获取心率数据 | 无 | HeartRateData | 1分后上服务器取数据 |
- 地址: /api/device/[device oid]/4g/action/[action]
- 方法: POST
- 验证方法: Cookie: user
- 响应对象: 无
- URL参数: device oid
- 请求范例:
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/device/868219000099926/4g/action/get_locationdataonce
- 响应范例:
{
"success": true
}
# 查看设备开关机数据
- 地址: /api/powerdata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [powerdata](./object.md#powerdata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
| type | 否 | string | 01,2,3 |
0开机,1关机,2正常电量显示,3低电 |
__请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/powerdata/?device=868219000099926&depth=1
> GET /api/powerdata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
__响应范例__
{
"objs": [
{
"_id": {
"$oid": "5f8fdb442642510b539b4b8d"
},
"device": "866815030630127",
"created_at": {
"$date": 1603292100907
},
"time_begin": {
"$date": 1603292100907
},
"type": "2",
"remaining_power": 48,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8fccd42642510b539b4afc"
},
"device": "866815030630127",
"created_at": {
"$date": 1603288404958
},
"time_begin": {
"$date": 1603288404958
},
"type": "2",
"remaining_power": 52,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8fb0cf2642510b539b4a64"
},
"device": "866815030630127",
"created_at": {
"$date": 1603281231509
},
"time_begin": {
"$date": 1603281231509
},
"type": "0",
"remaining_power": 57,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8f95f52642510b539b49e8"
},
"device": "866815030630127",
"created_at": {
"$date": 1603274357861
},
"time_begin": {
"$date": 1603274357861
},
"type": "0",
"remaining_power": 62,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8f93722642510b539b49dd"
},
"device": "866815030630127",
"created_at": {
"$date": 1603273714883
},
"time_begin": {
"$date": 1603273714883
},
"type": "0",
"remaining_power": 63,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8f8fdd2642510b539b49ca"
},
"device": "866815030630127",
"created_at": {
"$date": 1603272797654
},
"time_begin": {
"$date": 1603272797654
},
"type": "0",
"remaining_power": 64,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8f877b2642510b539b49b7"
},
"device": "866815030630127",
"created_at": {
"$date": 1603270651332
},
"time_begin": {
"$date": 1603270651332
},
"type": "2",
"remaining_power": 64,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8f796a2642510b539b498f"
},
"device": "866815030630127",
"created_at": {
"$date": 1603267050455
},
"time_begin": {
"$date": 1603267050455
},
"type": "2",
"remaining_power": 66,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8ede942642510b539b47b1"
},
"device": "866815030630127",
"created_at": {
"$date": 1603227412840
},
"time_begin": {
"$date": 1603227412840
},
"type": "2",
"remaining_power": 89,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8ed0822642510b539b4763"
},
"device": "866815030630127",
"created_at": {
"$date": 1603223810543
},
"time_begin": {
"$date": 1603223810543
},
"type": "2",
"remaining_power": 91,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8ec2572642510b539b4725"
},
"device": "866815030630127",
"created_at": {
"$date": 1603220183403
},
"time_begin": {
"$date": 1603220183403
},
"type": "2",
"remaining_power": 93,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8eb44e2642510b539b46f4"
},
"device": "866815030630127",
"created_at": {
"$date": 1603216590664
},
"time_begin": {
"$date": 1603216590664
},
"type": "0",
"remaining_power": 95,
"charging_statu": "0"
},
{
"_id": {
"$oid": "5f8eb08b2642510b539b46df"
},
"device": "866815030630127",
"created_at": {
"$date": 1603215627898
},
"time_begin": {
"$date": 1603215627898
},
"type": "1",
"remaining_power": 95,
"charging_statu": "0"
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 13,
"page_current": 1
},
"success": true,
"obj_name": "powerdata"
}
# 查看设备定位数据
- 地址: /api/locationdata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [locationdata](./object.md#locationdata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
__请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/locationdata/?device=868219000099926&depth=1&rows_per_page=1
> GET /api/locationdata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
__响应范例__
{
"objs": [
{
"_id": {
"$oid": "5f8fd2ff2642510b539b4b3e"
},
"device": "866815111111111",
"created_at": {
"$date": 1603289983968
},
"time_begin": {
"$date": 1603289983000
},
"type": "1",
"is_reply": false,
"is_track": false,
"statu": "",
"city": "广州市",
"city_code": "440112",
"address": "广东省 广州市 黄埔区 育星路 靠近创新大厦C1",
"point": {
"type": "Point",
"coordinates": [
113.4570717,
23.1667421
]
},
"cell": [
{
"mcc": "460",
"mnc": "1",
"lac": 9939,
"cid": 112479499,
"rssi": -85
}
],
"wifi": [
{
"addr": "48:3f:e9:a0:a9:85",
"ssid": "feng",
"rssi": -74
},
{
"addr": "d4:f7:86:3f:c1:bd",
"ssid": "ChinaNet-9fwj",
"rssi": -73
},
{
"addr": "28:c6:8e:39:03:c7",
"ssid": "BAIYI0001",
"rssi": -80
},
{
"addr": "2a:c6:8e:39:03:c8",
"ssid": "NETGEAR-Guest",
"rssi": -81
}
]
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 1,
"page_current": 1
},
"success": true,
"obj_name": "locationdata"
}
#批量获取设备在离线状态
- 地址: api/community/[community id]/devicesloc_new
- 方法: GET
- 验证方法: Cookie: user
- URL参数: [community id]
- 输出参数intro文档下 ## 分页参数
- 请求范例__
curl -v -A CURL -b cookies.txt http://api.aiqiangua.com:8888/api/community/59c8ca7a54625923636d5ea4/devicesloc_new/?rows_per_page=20&page=1
- 响应范例
{
"online_numbers": 1,
"objs": [
{
"_id": "868219000352358",
"type": "S5",
"sim_phone": "",
"owner": {
"$oid": "5cf0a36d89d44675cb4ba2a9"
},
"name": "S5",
"active": false,
"online": true,
"location_updated_at": {
"$date": 1563448634197
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570337,
23.1667234
]
},
"last_address": "广东省 广州市 黄埔区 观虹路 靠近创新大厦C1",
"wear_flag": 0,
"remaining_power": 95
},
{
"_id": "868995032925804",
"type": "SHIJIE_GPRS_BP",
"sim_phone": "",
"owner": {
"$oid": "5d19a6e84ee47949cb0c28d2"
},
"name": "血压计",
"active": false,
"online": false,
"location_updated_at": {
"$date": 28800000
},
"last_location": {
"type": "Point",
"coordinates": [
0,
0
]
},
"last_address": "",
"remaining_power": 0
},
{
"_id": "868995032935688",
"type": "BY102",
"sim_phone": "",
"owner": {
"$oid": "5cc29baa89d4464e9de8d969"
},
"name": "",
"active": false,
"online": false,
"location_updated_at": {
"$date": 28800000
},
"last_location": {
"type": "Point",
"coordinates": [
0,
0
]
},
"last_address": "",
"remaining_power": 0
},
{
"_id": "866801040011870",
"type": "S5",
"sim_phone": "",
"owner": {
"$oid": "5c9480aa89d44635e6e9c308"
},
"name": "S5",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1559556325638
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570166,
23.1667277
]
},
"last_address": "广东省 广州市 黄埔区 观虹路 靠近广州保利假日酒店",
"wear_flag": 1,
"remaining_power": 83
},
{
"_id": "868219000457736",
"type": "S1",
"sim_phone": "",
"owner": {
"$oid": "5be8d38fba2d126d0c50b8a5"
},
"name": "黄手环",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1562920103195
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570256,
23.1667244
]
},
"last_address": "广东省 广州市 黄埔区 观虹路 靠近创新大厦C1",
"remaining_power": 0
},
{
"_id": "868219000352150",
"type": "S5",
"sim_phone": "",
"owner": {
"$oid": "5bcee694ba2d121f3b50df9d"
},
"name": "S5 01",
"active": true,
"online": false,
"location_updated_at": {
"$date": 1542126743878
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570133,
23.1667196
]
},
"last_address": "广东省 广州市 黄埔区 育星路 靠近广州保利假日酒店",
"wear_flag": 0,
"remaining_power": 100
},
{
"_id": "868219000352325",
"type": "S5",
"sim_phone": "",
"owner": {
"$oid": "5c876b9989d446468c6b63fb"
},
"name": "S5白",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1553891667845
},
"last_location": {
"type": "Point",
"coordinates": [
113.4566862,
23.1671685
]
},
"last_address": "广东省 广州市 黄埔区 观虹路 靠近平安银行(广州科学城科技支行)",
"wear_flag": 0,
"remaining_power": 0
},
{
"_id": "869426021093635",
"type": "BY007",
"sim_phone": "12345678909",
"owner": {
"$oid": "5b51af7eba2d12021e7e1c3d"
},
"name": "曲奇",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1562773306360
},
"last_location": {
"type": "Point",
"coordinates": [
113.4555037,
23.1664366
]
},
"last_address": "广东省 广州市 黄埔区 育星路 靠近广州科学城创新大厦C3",
"remaining_power": 100
},
{
"_id": "868219000663366",
"type": "BY102",
"sim_phone": "",
"owner": {
"$oid": "5b518f65ba2d12022b67842c"
},
"name": "S2",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1543509496371
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570044,
23.1667079
]
},
"last_address": "广东省 广州市 黄埔区 育星路 靠近广州保利假日酒店",
"wear_flag": 1,
"remaining_power": 22
},
{
"_id": "866815030129575",
"type": "S3",
"sim_phone": "17223528845",
"owner": {
"$oid": "5bdac342ba2d124dbb9f5dcf"
},
"name": "S3",
"active": false,
"online": false,
"location_updated_at": {
"$date": 1544134530254
},
"last_location": {
"type": "Point",
"coordinates": [
113.4570245,
23.1667231
]
},
"last_address": "广东省 广州市 黄埔区 育星路 靠近广州保利假日酒店",
"wear_flag": 1,
"remaining_power": 0
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 10,
"page_current": 1
},
"success": true,
"obj_name": "devices_location"
}
# 查看设备运动数据
- 地址: /api/pedometerdata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [pedometerdata](./object.md#pedometerdata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
__请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8888/api/pedometerdata/?device=868219000099926
> GET /api/pedometerdata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
__响应范例__
{
"objs": [
{
"_id": {
"$oid": "5f8fdaf82642510b539b4b8c"
},
"device": "866815111111111",
"created_at": {
"$date": 1603292024556
},
"time_begin": {
"$date": 1603292023000
},
"value": 0,
"difference": 0,
"calorie": 0.0
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 1,
"page_current": 1
},
"success": true,
"obj_name": "pedometerdata"
}
# 查看设备心率数据
- 地址: /api/heartratedata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [heartratedata](./object.md#heartratedata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
__请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8888/api/heartratedata/?device=868219000099926&depth=1
> GET /api/heartratedata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
__响应范例__
{
"objs": [
{
"_id": {
"$oid": "5f8fe3f62642510b539b4bd7"
},
"device": "866815030630127",
"created_at": {
"$date": 1603294326391
},
"time_begin": {
"$date": 1603294325000
},
"heartrate": 65,
"measure_type": 0
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 1,
"page_current": 1
},
"success": true,
"obj_name": "heartratedata"
}
# 查看设备答复数据
- 地址: /api/replydata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [replydata](./object.md#replydata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
- 请求范例
curl -v -A CURL -b cookies.txt 'http://127.0.0.1:8888/api/replydata/?device=868219000099926
> GET /api/replydata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
__响应范例__
{
"objs": [
{
"_id": {
"$oid": "5f8fdece2642510b539b4baa"
},
"device": "866815030630127",
"time_begin": {
"$date": 1603293006687
},
"reply_type": 1,
"alert_name": "糖尿病药",
"result": 0,
"created_at": {
"$date": 1603293006687
}
},
{
"_id": {
"$oid": "5f8f9cbc2642510b539b4a08"
},
"device": "866815030630127",
"time_begin": {
"$date": 1603276092730
},
"reply_type": 1,
"alert_name": "运动",
"result": 1,
"created_at": {
"$date": 1603276092730
}
},
{
"_id": {
"$oid": "5f8ea3922642510a610700c5"
},
"device": "866815030630127",
"time_begin": {
"$date": 1603212306297
},
"reply_type": 1,
"alert_name": "运动",
"result": 1,
"created_at": {
"$date": 1603212306298
}
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 4,
"page_current": 1
},
"success": true,
"obj_name": "replydata"
}
# 查看设备血压数据
- 地址:/api/bloodpressuredata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [BloodPressureData](./object.md#BloodPressureData)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------| ------------------------------ |
| device id | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
- 请求范例
curl -v -A CURL -b cookies.txt 'http://127.0.0.1:8000/api/bloodpressuredata/?deviceid=868219000099988&depth=1&rows_per_page=1'
> GET /api/BloodPressureData/?device=358551050412329&depth=1&rows_per_page=1 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user='2|1:0|10:1500426685|4:user|12:b3BlcmF0b3I=|00f680f1ea4e9cdf5f175f4bd76cf4c53f953bed74118417b8fc58917f5b926d""
- 响应范例:
{
"objs": [
{
"_id": {
"$oid": "5f8fe3f62642510b539b4bd8"
},
"device": "866815030630127",
"created_at": {
"$date": 1603294326442
},
"time_begin": {
"$date": 1603294325000
},
"dbp": 87,
"sbp": 127,
"type": "",
"measure_type": 0,
"pul": 0,
"ano": false
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 1,
"page_current": 1
},
"success": true,
"obj_name": "bloodpressuredata"
}
# 查看设备血氧数据
- 地址: /api/bloodoxygendata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [heartratedata](./object.md#heartratedata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
__请求范例__
curl -v -A CURL -b cookies.txt http://127.0.0.1:8888/api/heartratedata/?device=868219000099926&depth=1
> GET /api/heartratedata/?device=868219000099926 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
-- 响应范例
{
"objs": [
{
"_id": {
"$oid": "5f8fef79264251111b3c3187"
},
"device": "866815111111111",
"created_at": {
"$date": 1603297273702
},
"time_begin": {
"$date": 1603297272000
},
"bloodoxygen": 96,
"measure_type": 1
},
{
"_id": {
"$oid": "5f8dcd312642510533a64909"
},
"device": "866815111111111",
"created_at": {
"$date": 1603157425160
},
"time_begin": {
"$date": 1603157425000
},
"bloodoxygen": 98,
"measure_type": 0
},
{
"_id": {
"$oid": "5f8d396726425177cccbaf55"
},
"device": "866815111111111",
"created_at": {
"$date": 1603119591938
},
"time_begin": {
"$date": 1603119590000
},
"bloodoxygen": 96,
"measure_type": 1
},
{
"_id": {
"$oid": "5f8d358d26425177cccbaf44"
},
"device": "866815111111111",
"created_at": {
"$date": 1603118605111
},
"time_begin": {
"$date": 1603118604000
},
"bloodoxygen": 96,
"measure_type": 1
},
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 14,
"page_current": 1
},
"success": true,
"obj_name": "bloodoxygendata"
}
# 查看设备紧急呼叫
- 地址: /api/sosdata/?device=[device oid] 跌倒数据 /api/falldata/?device=[device oid]
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: [sosdata](./object.md#sosdata)
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| device | 是 | string | 15位设备唯一序号 |
| time_begin | 否 | string | YYYYMMDD查询指定日期的数据 |
- 请求范例:
curl -v -A CURL -b cookies.txt http://127.0.0.1:8888/api/sosdata/?device=352057288155188
> GET /api/sosdata/?device=352057288155188 HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: "user="2|1:0|10:1473817034|4:user|16:MTg2ODA1NTUwNzA=|2768bb77396815e5a7ca9fe3c65dc8060943c57aeb078c746faf56036533aa12""
- 响应范例:
{
"objs": [
{
"_id": {
"$oid": "5f8fb1512642510b539b4a6b"
},
"device": "866815030630127",
"created_at": {
"$date": 1603281361189
},
"time_begin": {
"$date": 1603281359000
},
"type": "1",
"city": "广州市",
"address": "广东省 广州市 黄埔区 观虹路 靠近创新大厦C1",
"point": {
"type": "Point",
"coordinates": [
113.4563642,
23.1672453
]
},
"cell": [
{
"mcc": "460",
"mnc": "0",
"lac": 9475,
"cid": 45055509,
"rssi": -109
}
],
"wifi": [
{
"addr": "0c:4b:54:4f:19:85",
"ssid": "JTY_Office",
"rssi": -68
},
{
"addr": "b2:95:9d:3a:96:92",
"ssid": "CK",
"rssi": -84
},
{
"addr": "5c:0e:8b:8d:eb:60",
"ssid": "Wireless_LG",
"rssi": -74
}
],
"is_removed": false,
"communityid": "",
"push_result": "1"
},
{
"_id": {
"$oid": "5f8fab642642510b539b4a3f"
},
"device": "866815030630127",
"created_at": {
"$date": 1603279844553
},
"time_begin": {
"$date": 1603279844000
},
"type": "1",
"city": "广州市",
"address": "广东省 广州市 黄埔区 观虹路 靠近平安银行(广州科学城科技支行)",
"point": {
"type": "Point",
"coordinates": [
113.4566759,
23.1672331
]
},
"cell": [
{
"mcc": "460",
"mnc": "0",
"lac": 9475,
"cid": 45055519,
"rssi": -111
}
],
"wifi": [
{
"addr": "d4:f7:86:3f:c1:bd",
"ssid": "ChinaNet-9fwj",
"rssi": -35
},
{
"addr": "0c:4b:54:96:8a:8c",
"ssid": "BaiYiPC",
"rssi": -43
},
{
"addr": "28:c6:8e:39:03:c7",
"ssid": "BAIYI0001",
"rssi": -46
},
{
"addr": "2a:c6:8e:39:03:c8",
"ssid": "NETGEAR-Guest",
"rssi": -46
}
],
"is_removed": false,
"communityid": "",
"push_result": "1"
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 2,
"page_current": 1
},
"success": true,
"obj_name": "sosdata"
}
# 获取设备最新位置数据
- 地址: /api/device/[device oid]/data/locationdata/
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: 返回单个对象,如果对应的数据项有数据,则返回数据对象;如果没有则返回'{}'
- URL参数: device oid
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| type | 否 | string | 0:Gps定位; 1:基站定位 |
- 请求范例:
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/device/868219000099926/data/locationdata
- 响应范例:
{
"obj": {
"remaining_power": 47,
"temperature": 25,
"weather": "雷阵雨",
"pm25": 42,
"online": true,
"locationdata": {
"_id": {
"$oid": "5f8fe1b42642510b539b4bb9"
},
"time_begin": {
"$date": 1603293748000
},
"type": "1",
"city": "广州市",
"address": "广东省 广州市 黄埔区 观虹路 靠近平安银行(广州科学城科技支行)",
"point": {
"type": "Point",
"coordinates": [
113.4566442,
23.1672667
]
}
},
"wear_flag": 0
},
"success": true,
"obj_name": ""
}
# 获取设备环境音
- 地址: /api/deviceenvvoice/list/ 或 /api/device/[device oid]/deviceenvvoice/list/
- 方法: GET
- 验证方法: Cookie: user
- URL参数: device oid
- 请求参数:
- 请求范例:
curl -v -A CURL -b cookies.txt http://120.24.56.48:8889/api/device/866815030630127/deviceenvvoice/list/?depth=1
- 响应范例:
{
"objs": [
{
"_id": {
"$oid": "5f8ff64a264251111b3c31bf"
},
"user": {
"$oid": "5f8eae282642510b4bd152f5"
},
"device": "866815030630127",
"group": {
"$oid": "5f8eae282642510b4bd152f2"
},
"voice_time": {
"$date": 1603299018902
},
"voice_type": 0,
"media_length": 9094,
"filename": "20201021165018.amr",
"url": "/media/env_voice/866815030630127/20201021165018.amr",
"created_at": {
"$date": 1603299018912
}
}
],
"page": {
"page_count": 1,
"rows_per_page": 20,
"total": 1,
"page_current": 1
},
"success": true,
"obj_name": "deviceenvvoice"
}