- [HTTP request](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#body.aspect_1)
- [OutputConfig](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#OutputConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#OutputConfig.SCHEMA_REPRESENTATION)
- [GcsDestination](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#GcsDestination)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#GcsDestination.SCHEMA_REPRESENTATION)
- [BigQueryDestination](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#BigQueryDestination)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#BigQueryDestination.SCHEMA_REPRESENTATION)
- [Try it!](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2/projects.locations.catalogs/exportAnalyticsMetrics.md.txt#try-it)

Exports analytics metrics.

`Operation.response` is of type `ExportAnalyticsMetricsResponse`. `Operation.metadata` is of type `ExportMetadata`.

### HTTP request

`POST https://retail.googleapis.com/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics`

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

### Path parameters

| Parameters ||
|---|---|
| `catalog` | `string` Required. Full resource name of the parent catalog. Expected format: `projects/*/locations/*/catalogs/*` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "outputConfig": { object (`OutputConfig`) }, "filter": string } ``` |

| Fields ||
|---|---|
| `outputConfig` | ``object (`OutputConfig`)`` Required. The output location of the data. Only `bigqueryDestination` is supported, and `bigqueryDestination.table_type` must be set to `view`. |
| `filter` | `string` A filtering expression to specify restrictions on returned metrics. The expression is a sequence of terms. Each term applies a restriction to the returned metrics. Use this expression to restrict results to a specific time range. Currently we expect only one types of fields: - `timestamp`: This can be specified twice, once with a less than operator and once with a greater than operator. The `timestamp` restriction should result in one, contiguous, valid, `timestamp` range. Some examples of valid filters expressions: - Example 1: `timestamp > "2012-04-23T18:25:43.511Z" timestamp < "2012-04-23T18:30:43.511Z"` - Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` |

### Response body

If successful, the response body contains an instance of `Operation`.

### 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.md.txt#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `catalog` resource:

- `retail.catalogs.exportAnalyticsMetrics`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## OutputConfig

The output configuration setting.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "gcsDestination": { object (`GcsDestination`) }, "bigqueryDestination": { object (`BigQueryDestination`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The configuration of destination for holding output data. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `gcsDestination` | ``object (`GcsDestination`)`` The Google Cloud Storage location where the output is to be written to. |
| `bigqueryDestination` | ``object (`BigQueryDestination`)`` The BigQuery location where the output is to be written to. |
| End of mutually exclusive fields. ||

## GcsDestination

The Google Cloud Storage output destination configuration.

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

| Fields ||
|---|---|
| `outputUriPrefix` | `string` Required. The output uri prefix for saving output data to json files. Some mapping examples are as follows: outputUriPrefix sample output(assuming the object is foo.json) ======================== ============================================= gs://bucket/ gs://bucket/foo.json gs://bucket/folder/ gs://bucket/folder/foo.json gs://bucket/folder/item_ gs://bucket/folder/item_foo.json |

## BigQueryDestination

The BigQuery output destination configuration.

| JSON representation |
|---|
| ``` { "datasetId": string, "tableIdPrefix": string, "tableType": string } ``` |

| Fields ||
|---|---|
| `datasetId` | `string` Required. The ID of a BigQuery Dataset. |
| `tableIdPrefix` | `string` Required. The prefix of exported BigQuery tables. |
| `tableType` | `string` Required. Describes the table type. The following values are supported: - `table`: A BigQuery native table. - `view`: A virtual table defined by a SQL query. |