0

I am trying to fetch my blood-glucose data using Google fit rest API and using OAuth 2.0 Playground.

I've manually inserted data in the google fit app (fit app > Browse > Vitals > Blood glucose) and tried to fetch it using REST API and OAuth 2.0 Playground using the following request parameters.

scope: .../auth/fitness.blood_glucose.read

Request Parameters

POST /fitness/v1/users/me/dataset:aggregate HTTP/1.1 
Host: www.googleapis.com 
Content-length: 193 
Content-type: application/JSON 
Authorization: Bearer y**
{ 
 "aggregateBy": [{"dataTypeName": "com.google.blood_glucose"}],
 "bucketByTime": { "durationMillis": 86400000 }, 
 "startTimeMillis": 1663180200000, "endTimeMillis": 1665772200000 
}

I didn't get any errors but neither I got any data for the same. below is the sample response.

​{
  "bucket": [
    {
      "startTimeMillis": "1663180200000",
      "endTimeMillis": "1663266600000",
      "dataset": [
        {
          "dataSourceId": "derived:com.google.blood_glucose.summary:com.google.android.gms:aggregated",
          "point": []
        }
      ]
    },
     {
      "startTimeMillis": "1665685800000",
      "endTimeMillis": "1665772200000",
      "dataset": [
        {
          "dataSourceId": "derived:com.google.blood_glucose.summary:com.google.android.gms:aggregated",
          "point": []
        }
      ]
    }
  ]
}

All the points are empty even though I can see them in my data in google fit.

The issue is persisting particulary for blood glucose while the rest Health data points are working fine.

  • May be data is not synced from Google Fit app with backend yet? Is the other data instantly returned by REST API after updating in Google Fit app? – Smile Oct 14 '22 at 09:01
  • Data is Synced from the Google Fit app, I have tried uninstalling the app and then re-installing the app again the data was there. But I am not getting data using the REST API. – Rakshit Pandey Oct 17 '22 at 05:21
  • I've also tried for blood pressure same thing data is added manually but in that case, I am getting data from google fit REST API and OAuth 2.0 Playground. This issue only occurs for blood glucose. – Rakshit Pandey Oct 17 '22 at 05:39

1 Answers1

0

I'm afraid that there's no documentation available to read blood glucose records in Fit Android/Rest API. You may try Google's new Health Connect API, it supports BloodGlucoseRecord

https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/package-summary#classes

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34622522) – sanitizedUser Jul 06 '23 at 10:19