# Method: projects.locations.assets.aggregateValues

- [HTTP request](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.AggregateAssetsValuesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#body.aspect)
- [Aggregation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Aggregation)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Aggregation.SCHEMA_REPRESENTATION)
- [Count](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count)
- [Sum](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum)
- [Histogram](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram.SCHEMA_REPRESENTATION)
- [Frequency](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency)
- [AggregationResult](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#AggregationResult)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#AggregationResult.SCHEMA_REPRESENTATION)
- [Count](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count_1)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count_1.SCHEMA_REPRESENTATION)
- [Sum](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum_1)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum_1.SCHEMA_REPRESENTATION)
- [Histogram](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram_1)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram_1.SCHEMA_REPRESENTATION)
- [Bucket](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Bucket)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Bucket.SCHEMA_REPRESENTATION)
- [Frequency](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency_1)
  - [JSON representation](https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency_1.SCHEMA_REPRESENTATION)

Aggregates the requested fields based on provided function.

### HTTP request

`POST https://migrationcenter.googleapis.com/v1alpha1/{parent=projects/*/locations/*}/assets:aggregateValues`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. Parent value for `AggregateAssetsValuesRequest`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "aggregations": [ { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Aggregation`) } ], "filter": string, "showHidden": boolean } ``` |

| Fields ||
|---|---|
| `aggregations[]` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Aggregation`)`` Array of aggregations to perform. Up to 25 aggregations can be defined. |
| `filter` | `string` Optional. The aggregation will be performed on assets that match the provided filter. |
| `showHidden` | `boolean` Optional. When this value is set to 'true' the response will include all assets, including those that are hidden. |

### Response body

A response to a request to aggregated assets values.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "results": [ { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#AggregationResult`) } ] } ``` |

| Fields ||
|---|---|
| `results[]` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#AggregationResult`)`` The aggregation results. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## Aggregation

Message describing an aggregation. The message includes the aggregation type, parameters, and the field on which to perform the aggregation.

| JSON representation |
|---|
| ``` { "field": string, // Union field `aggregation_function` can be only one of the following: "count": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count`) }, "sum": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum`) }, "histogram": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram`) }, "frequency": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency`) } // End of list of possible types for union field `aggregation_function`. } ``` |

| Fields ||
|---|---|
| `field` | `string` The name of the field on which to aggregate. |
| Union field `aggregation_function`. `aggregation_function` can be only one of the following: ||
| `count` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count`)`` Count the number of matching objects. |
| `sum` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum`)`` Sum over a numeric field. |
| `histogram` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram`)`` Creates a bucketed histogram of field values. |
| `frequency` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency`)`` Creates a frequency distribution of all field values. |

## Count

This type has no fields.
Object count.

## Sum

This type has no fields.
Sum of field values.

## Histogram

Histogram of bucketed assets counts by field value.

| JSON representation |
|---|
| ``` { "lowerBounds": [ number ] } ``` |

| Fields ||
|---|---|
| `lowerBounds[]` | `number` Lower bounds of buckets. The response will contain `n+1` buckets for `n` bounds. The first bucket will count all assets for which the field value is smaller than the first bound. Subsequent buckets will count assets for which the field value is greater or equal to a lower bound and smaller than the next one. The last bucket will count assets for which the field value is greater or equal to the final lower bound. You can define up to 20 lower bounds. |

## Frequency

This type has no fields.
Frequency distribution of all field values.

## AggregationResult

Message describing a result of an aggregation.

| JSON representation |
|---|
| ``` { "field": string, // Union field `result` can be only one of the following: "count": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count_1`) }, "sum": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum_1`) }, "histogram": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram_1`) }, "frequency": { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency_1`) } // End of list of possible types for union field `result`. } ``` |

| Fields ||
|---|---|
| `field` | `string` |
| Union field `result`. `result` can be only one of the following: ||
| `count` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Count_1`)`` |
| `sum` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Sum_1`)`` |
| `histogram` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Histogram_1`)`` |
| `frequency` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Frequency_1`)`` |

## Count

The result of a count aggregation.

| JSON representation |
|---|
| ``` { "value": string } ``` |

| Fields ||
|---|---|
| `value` | `string (https://developers.google.com/discovery/v1/type-format format)` |

## Sum

The result of a sum aggregation.

| JSON representation |
|---|
| ``` { "value": number } ``` |

| Fields ||
|---|---|
| `value` | `number` |

## Histogram

The result of a bucketed histogram aggregation.

| JSON representation |
|---|
| ``` { "buckets": [ { object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Bucket`) } ] } ``` |

| Fields ||
|---|---|
| `buckets[]` | ``object (`https://docs.cloud.google.com/migration-center/docs/reference/rest/v1alpha1/projects.locations.assets/aggregateValues#Bucket`)`` Buckets in the histogram. There will be `n+1` buckets matching `n` lower bounds in the request. The first bucket will be from -infinity to the first bound. Subsequent buckets will be between one bound and the next. The final bucket will be from the final bound to infinity. |

## Bucket

A histogram bucket with a lower and upper bound, and a count of items with a field value between those bounds. The lower bound is inclusive and the upper bound is exclusive. Lower bound may be -infinity and upper bound may be infinity.

| JSON representation |
|---|
| ``` { "lowerBound": number, "upperBound": number, "count": string } ``` |

| Fields ||
|---|---|
| `lowerBound` | `number` Lower bound - inclusive. |
| `upperBound` | `number` Upper bound - exclusive. |
| `count` | `string (https://developers.google.com/discovery/v1/type-format format)` Count of items in the bucket. |

## Frequency

The result of a frequency distribution aggregation.

| JSON representation |
|---|
| ``` { "values": { string: string, ... } } ``` |

| Fields ||
|---|---|
| `values` | `map (key: string, value: string (https://developers.google.com/discovery/v1/type-format format))` An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |