在Google Fit REST API上创建数据源时出现问题氧气饱和度

问题描述

[google-fit]嗨!我想知道如何创建一个氧饱和度数据源。我已经尝试了许多组合,但是都没有成功,总是从API接收到“数据类型与名称相同的知名数据类型不匹配”。我唯一的猜测是我当前的 field 结构有问题:

{
"dataStreamId": "derived:com.google.oxygen_saturation:xxxxxxxxxxx","name": "myapp-oxygen_saturation-datasource-derived","type": "derived","dataType": {
    "name": "com.google.oxygen_saturation","field": [
        {
            "name": "oxygen_saturation","format": "floatPoint"
        },{
            "name": "supplemental_oxygen_flow_rate","format": "floatPoint"
        }
    ]
},"application": {
    "name": "myapp-derived"
}

}

,但是似乎没有使用REST Api的真实示例。任何帮助表示赞赏。

解决方法

in the documentation所述,com.google.oxygen_saturation数据类型具有5个字段。

您只提供2个,因此与Fit期望的不匹配。 (名称,类型和可选性也必须匹配)。

不要尝试自己提供字段定义,只需删除"field"键和值即可。 Fit会为您填写正确的字段,并在响应中返回它们。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...