Search code examples
google-apigoogle-fitgoogle-api-nodejs-clientmoto-360

Request Raw Sensor Data (Heart Rate) using Node.js or JS for Google Fit


Is there a way to request immediate heart rate sensor data using JavaScript or Node.js? Would this be the correct command?

raw:com.google.heart_rate.bpm:com.google.android.apps.fitness:Motorola:Moto 360:480c97:manual

Also, how would I request it using Node.js? I noticed that the JSON that is outputted from the OAuth Playground contains no numeric data of value. Thanks!


Solution

  • Accessing raw Sensor data may not be available to Rest API for Node.js or JS. Sensor API is only available using Android API.

    Rest API Overview

    enter image description here

    Android APIs

    enter image description here

    But you can still use Node.js or JS to store and access user data in the fitness store from apps on any platform.

    Get a particular data source

    https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:1234567890:Example%20Manufacturer:ExampleTablet:1000001:MyDataSource
    

    Here is the Node.js github of Google. Hope it helps!