Im following a video tutorial on how to use the google fit API for checking steps with node.js and managed to make everything work.
My problem is, when getting the value of steps, the point
array is returning empty.
Examples
Here are some examples on what is happening vs. what should happen.
my Request
const result = await axios({
method: 'POST',
headers: {
authorization: "Bearer " + tokens.tokens.access_token
},
"Content-Type": "application/json",
url: `https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate`,
data: {
aggregateBy: [{
dsataTypeName: "com.google.step_count.delta",
dataSourceId: 'derived:com.google.step_count.delta:com.google.android.gms:estimated_steps'
}],
bucketByTime: { durationMillis: 1000*60*60*24 },
startTimeMillis: 1642129199000, //get from https://currentmillis.com
endTimeMillis: 1642301999000
}
})
This result will return to me a data.bucket with the data im looking for. However, those buckets are looking like this:
When they should be looking like this (from the tutorial):
As you can see, my point array is empty rather then having some value.
I checked my Google fit App and I have data for this timespan.
Also noting that, even if I had taken 0 steps those days, the point array would not be empty, but would have value of 0.
Here is also the structure of the point array (also from tutorial):
Is there something I'm missing thats dumb?? pls help I never coded for Google APIs before