This section demonstrates reading the aggregate daily nutrition from a specific
data source. The response contains a list of buckets (one per 24-hour period),
each with a single dataset and datapoint that contains a field for all recorded
nutrition data types. If no nutrition values exist for a particular time
period, there is no dataset. If more than one `meal_type` is recorded, the
value will be set to `UNKNOWN`.

### Android

Your app can read the aggregate daily nutrition data for a user by creating
a data read request, and specifying the aggregate for the
['DataType.TYPE_NUTRITION'](https://developers.google.com/android/reference/com/google/android/gms/fitness/data/DataType#TYPE_NUTRITION) and
['DataType.AGGREGATE_NUTRITION_SUMMARY'](https://developers.google.com/android/reference/com/google/android/gms/fitness/data/DataType#AGGREGATE_NUTRITION_SUMMARY) data types, as shown in the
following example:

    val readRequest = DataReadRequest.Builder()
        .aggregate(DataType.AGGREGATE_NUTRITION_SUMMARY)
        .bucketByTime(1, TimeUnit.DAYS)
        .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
        .build()

### REST

Your app can read the aggregate daily nutrition data for a user by
making a `POST` request and querying the specified data source. You must
make a separate query for each data source.

**HTTP method**

    POST

**Request URL**

    https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate

**Request body**

    {
      "aggregateBy": [{
        "dataSourceId":
          "raw:com.google.nutrition:407408718192:MyDataSource"
      }],
      "bucketByTime": { "durationMillis": 86400000 },
      "startTimeMillis": 1471244400000,
      "endTimeMillis": 1471259040000
    }

**Response**

If the data source is created successfully, the response is a `200 OK`
status code. The response body contains a JSON representation of the data
source, including a `datasource.dataStreamId` property that you can use as
the data source ID for subsequent requests.

**CURL command**

    $ curl --header "Authorization: Bearer ya29.yourtokenvalue --request POST \
    --header "Content-Type: application/json;encoding=utf-8" --data @aggregate.json \
    https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate