---
title: "Test connection by data source definition"
method: POST
path: "/api/v1/actions/dataSource/test"
tags: ["Test Connection"]
---

# Test connection by data source definition

`POST /api/v1/actions/dataSource/test`

## Request

- Base URL: `https://www.gooddata.ai`
- URL: `https://www.gooddata.ai/api/v1/actions/dataSource/test`
- Auth: none declared

Test if it is possible to connect to a database using a connection provided by the data source definition in the request body.

## Request body

- TestDefinitionRequest: A request containing all information for testing data source definition.
  - `authenticationType` 'USERNAME_PASSWORD' | 'TOKEN' | 'KEY_PAIR' | 'CLIENT_SECRET' | 'OIDC_PASSTHROUGH', nullable: Type of authentication used to connect to the database. Determines how the supplied credentials are used (e.g. KEY_PAIR, OIDC_PASSTHROUGH).
  - `clientId` string: Id for client based authentication for data sources which supports it.
  - `clientSecret` string: Secret for client based authentication for data sources which supports it.
  - `parameters` DataSourceParameter[]
    - `name` string, required: Parameter name.
    - `value` string, required: Parameter value.
  - `password` string: Database user password.
  - `privateKey` string: Private key for data sources which supports key-pair authentication.
  - `privateKeyPassphrase` string: Passphrase for a encrypted version of a private key.
  - `schema` string: Database schema.
  - `token` string: Secret for token based authentication for data sources which supports it.
  - `type` 'POSTGRESQL' | 'REDSHIFT' | 'VERTICA' | 'SNOWFLAKE' | 'ADS' | 'BIGQUERY' | 'MSSQL' | 'PRESTO' | 'DREMIO' | 'AZURESQL' | 'SYNAPSESQL' | 'DATABRICKS' | 'GDSTORAGE' | 'CLICKHOUSE' | 'MYSQL' | 'MARIADB' | 'ORACLE' | 'PINOT' | 'SINGLESTORE' | 'MOTHERDUCK' | 'FLEXCONNECT' | 'STARROCKS' | 'ATHENA' | 'CRATEDB' | 'AILAKEHOUSE' | 'DENODO' | 'TRINO', required: Type of database, where test should connect to.
  - `url` string: URL to database in JDBC format, where test should connect to.
  - `username` string: Database user name.

## Response `200`

The result of the test of a data source connection.

- TestResponse: Response from notification channel testing.
  - `error` string: Field containing more details in case of a failure. Details are available to a privileged user only.
  - `queryDurationMillis` TestQueryDuration: A structure containing duration of the test queries run on a data source. It is omitted if an error happens.
    - `createCacheTable` integer: Field containing duration of a test 'create table as select' query on a datasource. In milliseconds. The field is omitted if a data source doesn't support caching.
    - `simpleSelect` integer, required: Field containing duration of a test select query on a data source. In milliseconds.
  - `successful` boolean, required: A flag indicating whether test passed or not.

---

[API](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api.md) - [All operations](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api/revisions/c728ef303bfb?raw)
