I am using nodejs and Google's official "googleapis" module. I am unable to get any value field from any data source.
var count = 0;
async.eachSeries(dataSources, function (source, nextSource) {
count++;
console.log(count, source.dataStreamId);
console.log('------------------------------------------------------------------------------------------------------------------------------');
fitness.users.dataSources.datasets.get({
dataSourceId: encodeURI(source.dataStreamId),
datasetId: new Date('2016-01-01').getTime() + '-' + new Date().getTime(),
userId: "me"
}, function (err, data) {
if (err) {
console.log(err);
return nextSource(err);
}
console.log("Data Set");
console.log(data);
nextSource(null);
});
}, function nextSource(err) {
if (err) {
return nextTask(err);
}
nextTask(null, 'OK')
});
All I get in response is something like:
{ minStartTimeNs: '1451606400000',
maxEndTimeNs: '1455532058239',
dataSourceId:
'derived:com.google.step_count.delta:com.google.android.gms:estimated_steps'
}
I had the same problem, but find the sollution.
"minStartTimeNs: '1451606400000', maxEndTimeNs: '1455532058239'"
They are not in the correct format, the api need epoch time in NANOSECOND (19 number), so its need to 1451606400000000000 and 1455532058239000000