If I go to google api playground I do the following steps:
Step 1: Select & authorize APIs. I select the two scopes
cause I need to read blood glucose and pressure from user.
I select a google user and authorize the application to read the data.
Step 2: Exchange authorization code for tokens. I exchange the authorization token for the access and refresh token.
Step 3: Configure request to API. From List possible operations I choose DataSources UsersLists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive; the user may have private data sources that are only visible to other developers, or calls using other scopes. Request: GET https://www.googleapis.com/fitness/v1/users/{userId}/dataSources
I change {userId} with me and I suppose to retrieve the data source to read blood glucose and blood pressure, but what I receive is an empty array. { "dataSource": [] }
I need to test the reading of such values (pressure and glucose). What steps do I have to in google playground to achieve these 2 readings?
Thanks in advance
To get blood pressure and glucose data, you first need to create that data. You see in the get api that your datasource is empty. Here is what you can do to create and get a blood pressure:
Signup using your google account,
Connect "Instant Heart Rate Monitor" application to "Google Fit" (go to Instant Heart Rate Monitor profile and click on Google Fit,...)
Measure your heart bpm using this application. Since this app is now connected with Google Fit, you will have a record in your datasource.
To get this record, have the current epoch time in nanoseconds (https://www.epochconverter.com/) and make the following GET call:
Note that in the above code, 1518561964000000000 is epoch time in nanoseconds and you need to change it to the current time. You can do the same thing for Glucose data with an application that measures blood Glucose :)