当前位置: 首页 > news >正文

API接口——睡眠带开放能力

本文介绍睡眠带相关接口。

API 列表

请求方法API描述
GET/v1.0/devices/{device_id}/sleep/daily-reports获取日睡眠报告。
GET/v1.0/devices/{device_id}/sleep/monthly-reports获取月睡眠报告。
GET/v1.0/devices/{device_id}/sleep/24h-reports获取 24 小时睡眠报告。
GET/v1.0/devices/{device_id}/sleep/preview/reports预览睡眠报告状态。
PUT/v1.0/devices/{device_id}/sleep/reports/{report_id}更新报告状态。

获取日睡眠报告

功能描述

获取日睡眠报告。

接口地址

GET /v1.0/devices/{device_id}/sleep/daily-reports

请求参数

参数名类型参数类型说明必填
device_idStringURI设备 ID。
report_timeLongURL获取设备所在时区报告的时间戳(精确到秒)。

返回参数

参数名参数类型描述
successBoolean是否成功:
  • true:成功
  • false:失败
statusString状态
tLong13 位标准时间戳
resultList返回结果

Result

参数名参数类型描述
reportsList睡眠报告

Reports

参数名参数类型描述
report_idLong报告 ID。
data_dateLong报告时间,精确到秒。
start_timeLong睡眠起始时间,精确到秒。
durationInt睡觉总时长,单位秒。
wakeInt清醒总时间,单位秒。
out_of_bed_durationInt离床时长,单位秒。
sleep_statusInt睡眠状态:
  • 0:设备未连接
  • 1:不在床
  • 2:清醒
  • 3:睡着
avg_breath_rateInt平均呼吸率。
avg_heart_rateInt平均心率。
snore_numberInt鼾声次数。
snore_durationInt鼾声总时长。
snore_high_proportionInt鼾声程度为高的比例。
snore_mid_proportionInt鼾声程度为中的比例。
snore_low_proportionInt鼾声程度为低的比例。
snore_non_proportionInt鼾声程度为无的比例。

请求示例

GET /v1.0/devices/vedeo887723I****/sleep/daily-reports?report_time=1594887507

返回示例

{"result": {"reports": [{"avg_breath_rate": 15,"avg_heart_rate": 56,"data_date": 1596577259,"duration": 238,"out_of_bed_duration": 528,"start_time": 1596477259,"wake": 205}]},"success": true,"t": 1597115614003
}

错误码

以下为该接口常见的业务异常,更多的异常错误,参见全局错误码。

错误码说明
500系统错误

获取月睡眠报告

功能描述

获取月睡眠报告。

接口地址

GET /v1.0/devices/{device_id}/sleep/monthly-reports

请求参数

参数名类型参数类型说明必填
device_idStringURI设备 ID。
report_timeLongURL获取设备所在时区报告的时间戳(精确到秒)。

返回参数

参数名参数类型描述
successBoolean是否成功:
  • true:成功
  • false:失败
statusString状态
tLong13 位标准时间戳
resultList返回结果

Result

参数名参数类型描述
reportsList睡眠报告

Reports

参数名参数类型描述
reportIdString报告 ID。
timeInteger时间。
posInteger周或月在指定年份的位置。例如,周接口中指定"pos": 8, 表示 2020 年的第 8 周。
yearInteger报告的年份。
daysInteger记录的天数
scoreInt平均分数。
scoreValueInt[]分数列表。
avg_sleep_timeInt平均睡眠时长,单位秒。
avg_fallasleep_timeInt平均入睡时长,单位秒。
sleep_time_valueInt[]实际睡眠时长列表,单位秒。
fallasleep_time_valueInt[]入睡时长列表,单位秒。
avg_sleep_percentageInt平均睡眠效率。
avg_deepsleep_percentageInt平均深睡比例。
sleep_percentage_valueInt[]睡眠效率列表。
deepsleep_percentage_valueInt[]深睡比例列表。
sleep_rule_statusInt睡眠规律:
  • 0:规律
  • 1:不规律
start_sleep_valueList开始睡觉时间列表。
wakeup_valueList清醒时间列表。
avg_breath_rateInt平均呼吸率。
breath_rate_valueInt[]呼吸率列表。
avg_heart_rateInt平均心率。
heart_rate_valueInt[]心率列表。
avg_inbed_timeInt平均赖床时长,单位秒。
inbed_time_valueInt[]赖床时长列表,单位秒。
avgawake_timesInt平均清醒次数。
awake_times_valueInt[]清醒次数列表。
avg_outofbed_timesInt起床次数。
outofbed_times_cntInt离床次数。
outofbed_times_valueInt[]起床次数列表。
factorsString周月状态值:
  • 0:没有
  • 1:有
score_percString分数占比状态:
  • 0:完美睡觉占比
  • 1:优秀睡觉占比
  • 2:一般睡觉占比
  • 3:睡觉差劲占比
  • 4:没有睡觉记录占比
sleep_hour_more9daysInt睡眠时长超过 9 个小时的天数。
sleep_hour_less6daysInt睡眠时长少于 6 个小时的天数。
heartbeat_pause_daysInt心跳过缓天数。
apnea_daysInt呼吸过缓天数。
avgSnore_timeInt平均鼾声时长。
snore_time_valueInt[]鼾声时长列表。

请求示例

GET /v1.0/devices/vedeo74882653500291/sleep/monthly-reports?report_time=1594887507

返回参数

{"result": {"reports": [{"apnea_days": 4,"avg_breath_rate": 15,"avg_deepsleep_percentage": 14,"avg_fallasleep_time": 24,"avg_heart_rate": 57,"avg_inbed_time": 55,"avg_outofbed_times": 5,"avg_sleep_percentage": 54,"avg_sleep_time": 297,"avg_snore_time": 0,"avgawake_times": 5,"awake_times_value": [3,2,2,9,0,10,11,-1,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"breath_rate_value": [15,15,15,15,15,15,15,-1,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"days": 8,"deepsleep_percentage_value": [6,11,0,21,46,0,3,-1,23,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"factors": "1,1,1,0,0","fallasleep_time_value": [37,5,58,5,5,57,10,-1,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"heart_rate_value": [56,56,56,59,60,57,59,-1,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"heartbeat_pause_days": 0,"inbed_time_value": [125,42,125,49,4,11,59,-1,22,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"outofbed_times_cnt": 7,"outofbed_times_value": [2,1,2,9,0,9,10,-1,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"pos": 8,"score": 48,"score_perc": "0,0,6,19,75","score_value": [54,48,34,61,36,32,45,-1,74,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"sleep_hour_less6days": 8,"sleep_hour_more9days": 1,"sleep_percentage_value": [34,85,13,58,98,38,40,-1,67,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"sleep_rule_status": 1,"sleep_time_value": [133,377,55,283,666,296,238,-1,328,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"snore_time_value": [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"start_sleep_value": ["00:04","23:43","01:54","00:29","00:07","23:54","23:40","","23:43","","","","","","","","","","","","","","","","","","","","","",""],"time": 1596211200,"wakeup_value": ["04:59","06:47","05:52","06:06","11:22","05:58","04:47","","05:48","","","","","","","","","","","","","","","","","","","","","",""],"year": 2020}]},"success": true,"t": 1597073472399
}

错误码

以下为该接口常见的业务异常,更多的异常错误,参见全局错误码。

错误码说明
500系统错误

获取 24 小时睡眠报告

功能描述

获取 24 小时睡眠报告。

接口地址

GET /v1.0/devices/{device_id}/sleep/24h-reports

请求参数

参数名类型参数类型说明必填
device_idStringURI设备 ID。
report_timeLongURL获取设备所在时区报告的时间戳(精确到秒)。

返回参数

参数名参数类型描述
successBoolean是否成功:
  • true:成功
  • false:失败
statusString状态
tLong13 位标准时间戳
resultList返回结果

result 说明

参数名参数类型描述
report_idLong报告 ID
start_timeLong睡眠起始时间
durationInt睡觉总时长
wakeInt清醒总时间
out_of_bed_durationInt离床时长
sleep_statusInt[]睡眠状态
avg_breath_rateInt平均呼吸率
avg_heart_rateInt平均心率
snore_numberInt鼾声次数
snore_durationInt鼾声总时长
snore_high_proportionInt鼾声程度为高的比例
snore_mid_proportionInt鼾声程度为中的比例
snore_low_proportionInt鼾声程度为低的比例
snore_non_proportionInt鼾声程度为无的比例

请求示例

GET /v1.0/devices/vedeo8877237278/sleep/24h-reports?report_time=1594887507

返回示例

{"result": {"reports": [{"avg_breath_rate": 15,"avg_heart_rate": 56,"duration": 238,"out_of_bed_duration": 528,"start_time": 1596477259,"wake": 205}]},"success": true,"t": 1597115614003
}

错误码

以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。

错误码说明
500系统错误

预览睡眠报告状态

功能描述

预览睡眠报告状态。

接口地址

GET /v1.0/devices/{device_id}/sleep/preview/reports

请求参数

参数名类型参数类型说明必填
device_idStringURI设备 ID。
start_timeLongURL设备所在时区开始时间的时间戳(精确到秒)。
end_timeLongURL设备所在时区结束时间的时间戳(精确到秒)。

返回参数

参数名参数类型描述
successBoolean是否成功:
  • true:成功
  • false:失败
statusString状态
tLong13 位标准时间戳
resultList返回结果

Result

参数名参数类型描述
report_idString报告 ID。
data_dateString查询时间,格式为yyyy-MM-dd
read_stateBoolean是否已读:
  • true:已读
  • false:未读

请求示例

GET /v1.0/devices/vedeo53424223/sleep/preview/reports?start_time=1590984264&end_time=1593489864

返回示例

{"result":[{"data_date": "2020-08-03","read_state": true,"report_id": 1355686}],"t":1594979100693,"success":true,"status":"ok"
}

错误码

以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。

错误码说明
500系统错误

更新报告状态

功能描述

更新报告读取状态。

接口地址

PUT /v1.0/devices/{device_id}/sleep/reports/{report_id}

请求参数

参数名类型参数类型说明必填
device_idStringURI设备 ID
report_idLongURL报告 ID

返回参数

参数名类型说明
codeInteger错误码。
successBoolean是否成功:
  • true:成功
  • false:失败
msgString请求失败的信息,成功为空。
resultBoolean返回结果。

请求示例

PUT /v1.0/devices/vedeo623232/sleep/reports/10002

返回示例

 

{ "result":true, "t":1542776517323 }

错误码

以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。

错误码说明
500系统错误
http://www.lryc.cn/news/18077.html

相关文章:

  • 面向对象的一点小想法
  • 数据仓库工作问题总结
  • Java常用算法
  • 插画网课平台排名
  • 雷达、定位、跟踪等信号处理邻域SCI期刊整理及推荐
  • NDK C++ 指针常量 常量指针 常量指针常量
  • 常见前端基础面试题(HTML,CSS,JS)(一)
  • Delphi RSA加解密
  • oracle基本操作
  • hive只复制表结构不复制表数据
  • 如何将Linux的NIC 名称更改为 eth0 而不是 enps33 或 enp0s25,只要几秒钟
  • 位运算笔记
  • 2023全国首个区块链平台发布,区块链绿色消费积分系统玩法悄然上市
  • 【异常】因为忘加了租户查询条件,导致重复ID导入失败Duplicate entry ‘XXX‘ for key ‘PRIMARY‘
  • 证明CPU指令是乱序执行的
  • css 属性和属性值的定义
  • Python获取中国大学MOOC某课程评论及其参与人数
  • 【C++】类和对象(完结篇)
  • 低代码开发可以解决哪些问题?
  • Linux 中使用 docker-compose 部署 MongoDB 6 以上版本副本集及配置 SSL / TLS 协议
  • JavaWeb--Mybatis练习
  • Springer-MTA期刊上传Latex要求
  • Graph Embedding基础 图表示学习 什么是Graph Embedding
  • 某直聘tp_token解析
  • 替代启攀微8按键触控八通道触摸芯片-GTC08L
  • Zabbix“专家坐诊”第182期问答汇总
  • PHP、Nginx、openssl ECC证书搭建
  • 秒杀服务------技术点及亮点
  • 【Python数据挖掘入门】一、数据挖掘概况
  • 【python】anaconda 管理 python 环境