Requires authorization
Adds 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 retrieve this dataset. Data points can belong to more than one dataset. This method does not use patch semantics. Try it now.
Request
HTTP request
PATCH https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId/datasets/datasetId
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
dataSourceId |
string |
The data stream ID of the data source that created the dataset. |
datasetId |
string |
Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: "startTime-endTime" where startTime and endTime are 64 bit integers. |
userId |
string |
Patch a dataset for the person identified. Use me to indicate
the authenticated user. Only me is supported at this time.
|
Optional query parameters | ||
currentTimeMillis |
long |
The client's current time in milliseconds since epoch. Note that the
minStartTimeNs and maxEndTimeNs properties in
the request body are in nanoseconds instead of milliseconds.
|
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 the relevant portions of a Users.dataSources.datasets resource, according to the rules of patch semantics, with the following properties:
Property name | Value | Description | Notes |
---|---|---|---|
Required Properties | |||
dataSourceId |
string |
The data stream ID of the data source that created the points in this dataset. | |
maxEndTimeNs |
long |
The largest end time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the second part of the dataset identifier. | |
minStartTimeNs |
long |
The smallest start time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the first part of the dataset identifier. | |
point[] |
list |
A partial list of data points contained in the dataset, ordered by largest endTimeNanos first. This list is considered complete when retrieving a small dataset and partial when patching a dataset or retrieving a dataset that is too large to include in a single response. | |
point[].dataTypeName |
string |
The data type defining the format of the values in this data point. | |
point[].endTimeNanos |
long |
The end time of the interval represented by this data point, in nanoseconds since epoch. | |
point[].startTimeNanos |
long |
The start time of the interval represented by this data point, in nanoseconds since epoch. | |
point[].value[] |
list |
Values of each data type field for the data point. It is expected that each value corresponding to a data type field will occur in the same order that the field is listed with in the data type specified in a data source. Only one of integer and floating point fields will be populated, depending on the format enum value within data source's type field. |
Response
If successful, this method returns a Users.dataSources.datasets resource in the response body.
Try it!
Use the APIs Explorer below to call this method on live data and see the response.