Google Fitness API添加数据

时间:2019-09-24 20:56:07

标签: rest api google-api

我对将数据添加到Google Fit应用程序的过程有些困惑。我基本上想要的是将消耗的卡路里添加到应用程序中。我创建了一个数据源:

{
  "dataStreamName": "MyDataSource",
  "type": "derived",
  "application": {
    "name": "MyApplication",
    "version": "1"
  },
  "dataType": {
    "field": [
      {
        "name": "calories",
        "format": "floatPoint"
      }
    ],
    "name": "com.google.calories.expended"
  },
  "device": {
    "manufacturer": "MyWatch",
    "model": "Newest",
    "type": "watch",
    "uid": "18d2g6h",
    "version": "1.0"
  }
}

,然后使用

更新数据源
{
  "dataSourceId": "derived:com.google.calories.expended:***",
  "maxEndTimeNs": 1569356081485728374,
  "minStartTimeNs": 1569345255182746392,
  "point": [
    {
      "dataTypeName": "com.google.calories.expended",
      "endTimeNanos": 1569356081485728374,
      "originDataSourceId": "",
      "startTimeNanos": 1569345255182746392,
      "value": [
        {
          "fpVal": 111
        }
      ]
    }
  ]
}

它确实返回200 OK响应,但是卡路里未显示在Google Fit应用中,我在做什么错了?

0 个答案:

没有答案