- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- Interval
- RollupDataPoint
- Examples
- Try it!
Roll up data points over physical time intervals for supported data types.
HTTP request
POST https://health.googleapis.com/v4/{parent=users/*/dataTypes/*}/dataPoints:rollUp
The URL uses gRPC Transcoding syntax. To know more about valid error responses that can be thrown by this HTTP request, please refer to the service error catalog
Path parameters
| Parameters | |
|---|---|
parent |
Required. Parent data type of the Data Point collection. Format:
For a list of the supported data types see the |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{
"range": {
object ( |
| Fields | |
|---|---|
range |
Required. Closed-open range of data points that will be rolled up. The maximum range for |
windowSize |
Required. The size of the time window to group data points into before applying the aggregation functions. A duration in seconds with up to nine fractional digits, ending with ' |
pageSize |
Optional. The maximum number of data points to return. If unspecified, at most 1440 data points will be returned. The maximum page size is 10000; values above that will be truncated accordingly. |
pageToken |
Optional. The nextPageToken from a previous request, if any. All other request fields need to be the same as in the initial request when the page token is specified. |
dataSourceFamily |
Optional. The data source family name to roll up. If empty, data points from all available data sources will be rolled up. Format: The supported values are:
|
Response body
Response containing the list of rolled up data points.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{
"rollupDataPoints": [
{
object ( |
| Fields | |
|---|---|
rollupDataPoints[] |
Values for each aggregation time window. |
nextPageToken |
A token, which can be sent as |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/googlehealth.activity_and_fitnesshttps://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonlyhttps://www.googleapis.com/auth/googlehealth.health_metrics_and_measurementshttps://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonlyhttps://www.googleapis.com/auth/googlehealth.locationhttps://www.googleapis.com/auth/googlehealth.location.readonlyhttps://www.googleapis.com/auth/googlehealth.nutritionhttps://www.googleapis.com/auth/googlehealth.nutrition.readonlyhttps://www.googleapis.com/auth/googlehealth.sleephttps://www.googleapis.com/auth/googlehealth.sleep.readonly
For more information, see the OAuth 2.0 Overview.
Interval
Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive).
The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.
| JSON representation |
|---|
{ "startTime": string, "endTime": string } |
| Fields | |
|---|---|
startTime |
Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
endTime |
Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
RollupDataPoint
Value of a rollup for a single physical time interval (aggregation window)
| JSON representation |
|---|
{ "startTime": string, "endTime": string, // Union field |
| Fields | |
|---|---|
startTime |
Start time of the window this value aggregates over Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
endTime |
End time of the window this value aggregates over Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
Union field
The field names usually follow the format If there were no data points in this interval, the value will not be set. These messages represent the aggregated data payload for each data type and are embedded within the |
|
steps |
Returned by default when rolling up data points from the |
floors |
Returned by default when rolling up data points from the |
heartRate |
Returned by default when rolling up data points from the |
weight |
Returned by default when rolling up data points from the |
altitude |
Returned by default when rolling up data points from the |
distance |
Returned by default when rolling up data points from the |
bodyFat |
Returned by default when rolling up data points from the |
totalCalories |
Returned by default when rolling up data points from the |
activeZoneMinutes |
Returned by default when rolling up data points from the |
sedentaryPeriod |
Returned by default when rolling up data points from the |
runVo2Max |
Returned by default when rolling up data points from the |
caloriesInHeartRateZone |
Returned by default when rolling up data points from the |
activityLevel |
Returned by default when rolling up data points from the |
hydrationLog |
Returned by default when rolling up data points from the |
timeInHeartRateZone |
Returned by default when rolling up data points from the |
activeMinutes |
Returned by default when rolling up data points from the |