---
title: "Test data source connection by data source id"
method: POST
path: "/api/v1/actions/dataSources/{dataSourceId}/test"
tags: ["Test Connection"]
---

# Test data source connection by data source id

`POST /api/v1/actions/dataSources/{dataSourceId}/test`

## Request

- Base URL: `https://www.gooddata.ai`
- URL: `https://www.gooddata.ai/api/v1/actions/dataSources/{dataSourceId}/test`
- Auth: none declared

Test if it is possible to connect to a database using an existing data source definition.

## Path parameters

- `dataSourceId` string, required

## Request body

- TestRequest: A request containing all information for testing existing data source.
  - `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.
  - `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)
