I have seen that a Fitness History API already exists for android but i can't find anything similar for REST services. All i want to do is get the fitness activities of an authorized user's account. For example, i would like to get all the "walking" activities that he did in a specific day or period. Is there a simple way of doing this from a web app, since the documentation can be confusing?
Fit has a full REST API available. To get activities (called sessions in the API) you'll want to use the Users.sessions.list method. It supports startTime
and endTime
parameters to timebox results and once you have the results you can filter them based on activityType. In this case activityType
for walking is 7
but also potentially 93
, 94
, and 95
for more specific types of walking.
If you get an access_token
authorized with the scope of https://www.googleapis.com/auth/fitness.activity.read
you can get a list of sessions for the current user as simple as:
https://www.googleapis.com/fitness/v1/users/me/sessions?access_token=xyz123
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With