Users.dataSources: create

Requires authorization

Creates a new data source that is unique across all data sources belonging to this user. The data stream ID field can be omitted and will be generated by the server with the correct format. The data stream ID is an ordered combination of some fields from the data source. In addition to the data source fields reflected into the data source ID, the developer project number that is authenticated when creating the data source is included. This developer project number is obfuscated when read by any other developer reading public data types.

Request

HTTP request

POST https://www.googleapis.com/fitness/v1/users/userId/dataSources

Parameters

Parameter name Value Description
Path parameters
userId string Create the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/fitness.activity.write
https://www.googleapis.com/auth/fitness.location.write
https://www.googleapis.com/auth/fitness.body.write
https://www.googleapis.com/auth/fitness.nutrition.write
https://www.googleapis.com/auth/fitness.blood_pressure.write
https://www.googleapis.com/auth/fitness.blood_glucose.write
https://www.googleapis.com/auth/fitness.oxygen_saturation.write
https://www.googleapis.com/auth/fitness.body_temperature.write
https://www.googleapis.com/auth/fitness.reproductive_health.write

Request body

In the request body, supply a Users.dataSources resource with the following properties:

Property name Value Description Notes
Required Properties
application nested object Information about an application which feeds sensor data into the platform.
application.name string The name of this application. This is required for REST clients, but we do not enforce uniqueness of this name. It is provided as a matter of convenience for other developers who would like to identify which REST created an Application or Data Source.
dataType nested object The data type defines the schema for a stream of data being collected by, inserted into, or queried from the Fitness API.
dataType.field[] list A field represents one dimension of a data type.
dataType.field[].format string The different supported formats for each field in a data type.

Acceptable values are:
  • "blob"
  • "floatList"
  • "floatPoint"
  • "integer"
  • "integerList"
  • "map"
  • "string"
dataType.field[].name string Defines the name and format of data. Unlike data type names, field names are not namespaced, and only need to be unique within the data type.
dataType.name string Each data type has a unique, namespaced, name. All data types in the com.google namespace are shared as part of the platform.
device nested object Representation of an integrated device (such as a phone or a wearable) that can hold sensors.
device.manufacturer string Manufacturer of the product/hardware.
device.model string End-user visible model name for the device.
device.type string A constant representing the type of the device.

Acceptable values are:
  • "chestStrap"
  • "headMounted"
  • "phone"
  • "scale"
  • "tablet"
  • "unknown"
  • "watch"
device.uid string The serial number or other unique ID for the hardware. This field is obfuscated when read by any REST or Android client that did not create the data source. Only the data source creator will see the uid field in clear and normal form.

device.version string Version string for the device hardware/software.
type string A constant describing the type of this data source. Indicates whether this data source produces raw or derived data.

Acceptable values are:
  • "derived"
  • "raw"

Response

If successful, this method returns a Users.dataSources resource in the response body.

Send feedback about...