【发布时间】:2016-09-18 17:42:39
【问题描述】:
我可以使用这段代码(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
}
})
这是所有活动类型消耗的卡路里。如何只为踏步活动消耗卡路里?
【问题讨论】:
-
更新:我应该添加
bucketByActivityType: { activityDataSourceId: 'derived:com.google.step_count.delta:com.google.android.gms:estimated_steps' }吗?我不知道这种存储桶类型是否可以一起使用。 -
您可以参考这个链接:stackoverflow.com/questions/37820404/…
标签: node.js rest google-fit