Google Fit: API 仅获取数据源的详细信息,但不获取 nodejs 中卡路里的详细信息
Google Fit: API gets only details of datasources but not the details of calories in nodejs
我只得到了数据源的详细信息,但我没有得到 google 健康消耗的卡路里。如何获得燃烧卡路里的详细信息。
我可以从 (Google Fitness API returns only {} as result) 中获取此信息,如下所示,但不能从 Activity 信息中获取。
Request:
https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.calories.expended:com.google.calories.consumed:merge_calories_expended?access_token=88888888888888888888
Response:
{ dataStreamId: 'derived:com.google.calories.expended:com.google.calories.consumed:merge_calories_expended',
dataStreamName: 'merge_calories_expended',
type: 'derived',
dataType: [Object],
application: [Object] }
您可以通过发送 GET 请求到列出可用的数据源
https://www.googleapis.com/fitness/v1/users/me/dataSources
查看结果我可以看到一个数据源 ID "derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended"
使用 URL 中的那个,我得到了卡路里数据集:
https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended/datasets/1451606400000000000-1455888676947965751
结果:
{
"minStartTimeNs"=>"1451606400000000000",
"maxEndTimeNs"=>"1455888676947965751",
"dataSourceId"=>
"derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended",
"point"=>
[{"startTimeNanos"=>"1455883200000000000",
"endTimeNanos"=>"1455883500000000000",
"dataTypeName"=>"com.google.calories.expended",
"originDataSourceId"=>
"derived:com.google.calories.expended:com.google.android.gms:from_activities",
"value"=>[{"fpVal"=>5.666666507720947}],
"modifiedTimeMillis"=>"1455888999993"}]}
另请参阅 https://support.google.com/fit/?hl=en#6075066
处的注释
Note: To see the distance you've gone or how many calories you've burned, you'll need to fill out your height, weight, and gender.
我只得到了数据源的详细信息,但我没有得到 google 健康消耗的卡路里。如何获得燃烧卡路里的详细信息。 我可以从 (Google Fitness API returns only {} as result) 中获取此信息,如下所示,但不能从 Activity 信息中获取。
Request:
https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.calories.expended:com.google.calories.consumed:merge_calories_expended?access_token=88888888888888888888
Response:
{ dataStreamId: 'derived:com.google.calories.expended:com.google.calories.consumed:merge_calories_expended',
dataStreamName: 'merge_calories_expended',
type: 'derived',
dataType: [Object],
application: [Object] }
您可以通过发送 GET 请求到列出可用的数据源 https://www.googleapis.com/fitness/v1/users/me/dataSources
查看结果我可以看到一个数据源 ID "derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended"
使用 URL 中的那个,我得到了卡路里数据集: https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended/datasets/1451606400000000000-1455888676947965751
结果:
{ "minStartTimeNs"=>"1451606400000000000", "maxEndTimeNs"=>"1455888676947965751", "dataSourceId"=> "derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended", "point"=> [{"startTimeNanos"=>"1455883200000000000", "endTimeNanos"=>"1455883500000000000", "dataTypeName"=>"com.google.calories.expended", "originDataSourceId"=> "derived:com.google.calories.expended:com.google.android.gms:from_activities", "value"=>[{"fpVal"=>5.666666507720947}], "modifiedTimeMillis"=>"1455888999993"}]}
另请参阅 https://support.google.com/fit/?hl=en#6075066
处的注释Note: To see the distance you've gone or how many calories you've burned, you'll need to fill out your height, weight, and gender.