Google

Fitness API

The Fitness API for managing users' fitness tracking data.

Developer tools#openapi#analytics#media

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The Fitness API for managing users' fitness tracking data.

Endpoints 13

users.dataSources

  • GETLists all data sources that are visible to the developer, using the OAuth scopes provided/:userId/dataSources?dataTypeName=stringLists 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…
  • POSTCreates a new data source that is unique across all data sources belonging to this user/:userId/dataSourcesCreates a new data source that is unique across all data sources belonging to this user. A data source is a unique source of sensor data. Data sources can…
  • GETReturns the specified data source./:userId/dataSources/:dataSourceIdReturns the specified data source.
  • PUTUpdates the specified data source/:userId/dataSources/:dataSourceIdUpdates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified.…
  • DELETEDeletes the specified data source/:userId/dataSources/:dataSourceIdDeletes the specified data source. The request will fail if the data source contains any data points.

users.dataSources.dataPointChanges

  • GETQueries for user's data point changes for a particular data source./:userId/dataSources/:dataSourceId/dataPointChanges?limit=0&pageToken=stringQueries for user's data point changes for a particular data source.

users.dataSources.datasets

  • GETReturns a dataset containing all data points whose start and end times overlap with the specified range of the dataset…/:userId/dataSources/:dataSourceId/datasets/:datasetId?limit=0&pageToken=stringReturns a dataset containing all data points whose start and end times overlap with the specified range of the dataset minimum start time and maximum end…
  • DELETEPerforms an inclusive delete of all data points whose start and end times have any overlap with the time range…/:userId/dataSources/:dataSourceId/datasets/:datasetIdPerforms an inclusive delete of all data points whose start and end times have any overlap with the time range specified by the dataset ID. For most data…
  • PATCHAdds data points to a dataset/:userId/dataSources/:dataSourceId/datasets/:datasetIdAdds data points to a dataset. The dataset need not be previously created. All points within the given dataset will be returned with subsquent calls to…

users.dataset

  • POSTAggregates data of a certain type or stream into buckets divided by a given type of boundary/:userId/dataset:aggregateAggregates data of a certain type or stream into buckets divided by a given type of boundary. Multiple data sets of multiple types and from multiple sources…

users.sessions

  • PUTUpdates or insert a given session./:userId/sessions/:sessionIdUpdates or insert a given session.
  • DELETEDeletes a session specified by the given session ID./:userId/sessions/:sessionIdDeletes a session specified by the given session ID.
  • GETLists sessions previously created./:userId/sessions?activityType=0&endTime=string&includeDeleted=true&pageToken=string&startTime=stringLists sessions previously created.

API details

Base URL
https://fitness.googleapis.com/fitness/v1/users
Authentication
OAuth 2.0 (authorization code flow) with 22 scopes
An API key in the key query parameter
Operations
13 operations on 7 pathsGET 5DELETE 3PUT 2POST 2PATCH 1
Main resources
users.dataSources 5users.dataSources.datasets 3users.sessions 3users.dataSources.dataPointChanges 1users.dataset 1
Response formats
application/json
Description format
Google API Discovery, API version v1

How to test the Fitness API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Fitness API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses OAuth 2.0 (authorization code flow) with 22 scopes. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Lists all data sources that are visible to the developer, using the OAuth scopes provided” (GET /:userId/dataSources?dataTypeName=string), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Fitness API?

The Fitness API for managing users' fitness tracking data. It is listed under Developer tools and has 13 endpoints.

Who publishes the Fitness API?

It is listed from Google's public API description (an OpenAPI document), not published by Google on Swastik Codes. Anyone who controls googleapis.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Fitness API?

Requests go to https://fitness.googleapis.com/fitness/v1/users. Endpoint paths are added to this base URL.

How do I authenticate with the Fitness API?

It accepts 2 methods: OAuth 2.0 (authorization code flow) with 22 scopes; an API key in the key query parameter.

How many endpoints does the Fitness API have?

13 operations on 7 paths (5 GET, 3 DELETE, 2 PUT, 2 POST, 1 PATCH). The largest groups are users.dataSources, users.dataSources.datasets, users.sessions, users.dataSources.dataPointChanges.

Is forking the Fitness API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.