- [HTTP request](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#body.aspect)
- [Try it!](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.testCases/import#try-it)

Imports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected.

This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:

- `metadata`: `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ImportTestCasesMetadata`
- `response`: `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ImportTestCasesResponse`

### HTTP request

Choose an endpoint:
global   
`POST https://dialogflow.googleapis.com/v3beta1/{parent=projects/*/locations/*/agents/*}/testCases:import`

<br />

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

**OR**

`POST https://{endpoint}/v3beta1/{parent=projects/*/locations/*/agents/*}/testCases:import`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The agent to import test cases to. Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `dialogflow.testcases.import` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "gcsUri": string, "content": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| Required. The source to import. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `gcsUri` | `string` The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to import test cases from. The format of this URI must be `gs://<bucket-name>/<object-name>`. Dialogflow performs a read operation for the Cloud Storage object on the caller's behalf, so your request authentication must have read permissions for the object. For more information, see [Dialogflow access control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). |
| `content` | `string (https://developers.google.com/discovery/v1/type-format format)` Uncompressed raw byte content for test cases. A base64-encoded string. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.operations#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

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

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