Reputation: 533
I am only getting the details of the dataSources, but I am not getting the calories burned from google fit. How its possible to get the details of calories burned. I can get this information from (Google Fitness API returns only {} as result) this code like the below one but not the Activity information.
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] }
Upvotes: 1
Views: 639
Reputation: 1021
You can list the available datasources by sending GET request to https://www.googleapis.com/fitness/v1/users/me/dataSources
Looking at the result I can see a dataSource id "derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended"
Using that in the URL, I get the calories dataset: https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.calories.expended:com.google.android.gms:platform_calories_expended/datasets/1451606400000000000-1455888676947965751
Resulting:
{ "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"}]}
Also see the note at 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.
Upvotes: 1