Users.dataSources: update

Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified.

Data sources are identified by their dataStreamId. Try it now.

Request

HTTP request

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

Parameters

Parameter name Value Description
Path parameters
dataSourceId string The data stream ID of the data source to update.
userId string Update 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:

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

For more information, see the authentication and authorization page.

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.
dataStreamId string A unique identifier for the data stream produced by this data source. The identifier includes:

  • The physical device's manufacturer, model, and serial number (UID).
  • The application's package name or name. Package name is used when the data source was created by an Android application. The developer project number is used when the data source was created by a REST client.
  • The data source's type.
  • The data source's stream name.
Note that not all attributes of the data source are used as part of the stream identifier. In particular, the version of the hardware/the application isn't used. This allows us to preserve the same stream through version updates. This also means that two DataSource objects may represent the same data stream even if they're not equal.

The exact format of the data stream ID created by an Android application is: type:dataType.name:application.packageName:device.manufacturer:device.model:device.uid:dataStreamName

The exact format of the data stream ID created by a REST client is: type:dataType.name:developer project number:device.manufacturer:device.model:device.uid:dataStreamName

When any of the optional fields that make up the data stream ID are absent, they will be omitted from the data stream ID. The minimum viable data stream ID would be: type:dataType.name:developer project number

Finally, the developer project number and device UID are obfuscated when read by any REST or Android client that did not create the data source. Only the data source creator will see the developer project number in clear and normal form. This means a client will see a different set of data_stream_ids than another client with different credentials.

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"
  • "smartDisplay"
  • "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.

The obfuscation preserves equality; that is, given two IDs, if id1 == id2, obfuscated(id1) == obfuscated(id2).

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.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.