Google Fit REST API:获取每项活动消耗的卡路里

时间:2016-09-18 17:42:40

标签: node.js rest google-fit

使用此代码(Node.JS)可以获得一段时间内消耗的卡路里:

 request({
        method: 'POST',
        uri: 'https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate',
        headers: {
          'Content-Type': 'application/json;encoding=utf-8',
          'Authorization': 'Bearer ' + accessToken
        },
        body: {
          aggregateBy: [{
            dataSourceId: 'derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended'
          }],
          bucketByTime: { durationMillis: (endTimeMillis - startTimeMillis) },
          startTimeMillis: startTimeMillis,
          endTimeMillis: endTimeMillis
        } 
    })

这是所有活动类型燃烧的卡路里。如何仅为步骤活动消耗卡路里?

0 个答案:

没有答案