I would like to get my heart rate data stored on Google Fit. Through this page I can try the API: https://developers.google.com/fit/rest/v1/reference/users/dataSources/datasets/get?apix=true and work because the json result is:
{
"minStartTimeNs": "1607036400000000000",
"maxEndTimeNs": "1607122800000000000",
"dataSourceId": "raw:com.google.heart_rate.bpm:AA:62:2a5297f4:Notify for Amazfit - heart rate",
"point": [
{
"startTimeNanos": "1607036509703000000",
"endTimeNanos": "1607036509703000000",
"dataTypeName": "com.google.heart_rate.bpm",
"value": [
{
"fpVal": 46,
"mapVal": []
}
],
"modifiedTimeMillis": "1607076710847"
},
...
...
...
If I click on the javascript tab it generates the code that must only be modified with API_KEY and CLIENT_ID but if I run it the result is:
minStartTimeNs "1607036400000000000"
maxEndTimeNs "1607122800000000000"
dataSourceId "raw:com.google.heart_rate.bpm:com.mc.amazfit1:Amazfit:Amazfit Bip Watch:97f19a4a:Notify for Amazfit - heart rate"
point []
The "point" array is empty. Without any errors, it doesn't tell me, that I don't have access, or the scope is wrong, it's just empty. Even looking with the firefox debugger the ajax calls are identical, only the access token changes. how can I do? thanks.
I see you are using the device's datasource directly (Amazfit Bip watch), not the derived Google Fit datasource. When I tried accessing the device's datasources, I also saw no data returned. After much trial and error, I had better luck fetching it from the derived sources, examples below.
Obviously, the only other time I have seen this happen (point []) is when there is no data for that timeframe, i.e. the datasetId (start-end). It is common with 'Heart Points' and 'Active Minutes'. But I wouldn't think that would be the case for heart rate data (unless you weren't wearing the watch).