I am currently developing an application which uses the Google Fit REST API to read user step count, heart rate, active minutes and what not.
I am playing around with the API in the Google API Explorer and I am trying things out. My issue is that I cannot retrieve the data points in a data set for a raw data source: I am trying to read the cumulative step count from my Samsung phone. Here is the request:
GET https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId/datasets/datasetId
Well, so far so good. I've used the following data source:
raw:com.google.step_count.cumulative:samsung:SM-G975F:bf2be7d8:SAMSUNG Step Counter Sensor
And the datasetId (the time period): 1580986385000000000-1581072785000000000
.
My issue is that I don't get any data points in the response and this really confuses me:
{
"minStartTimeNs": "1580986385000000000",
"maxEndTimeNs": "1581072785000000000",
"dataSourceId": "raw:com.google.step_count.cumulative:samsung:SM-G975F:bf2be7d8:SAMSUNG Step Counter Sensor",
"point": []
}
What is the most suitable way to retrieve the cumulative step count at any given moment? What data source should I use? I've tried reading the documentation and various Stack Overflow questions, but I didn't manage to find a suitable answer, as there are a lot of data sources available for my account.
And also, what are the most suitable data sources to use when retrieving the heart rate, the step count and the active minutes?
Thank you.
Cumulative step count is not a public data type. You can't read it from the REST API as a third-party developer.
The public data types are listed in the documentation. You can get com.google.step_count.delta
, which is the difference between consecutive cumulative step count samples.