Data Connect Hub REST API (0.1.0)

Download OpenAPI specification:

License: Apache-2.0

REST API for managing data connections and connection types.

Authentication

All endpoints except /health require a bearer token. All endpoints except /health and /audit/data-connection-types additionally require the x-tenant-id header.

A missing or invalid token returns 401, and a token that lacks permission for the requested operation returns 403. A missing or empty x-tenant-id header is a request validation failure and returns 400, not 401; a well-formed header naming a tenant you cannot access returns 403.

1. Obtain a token

For your own user:

export user_token=$(oc whoami -t)

For a ServiceAccount, bind the audience the service expects:

export user_token=$(oc create token <sa-name> -n <namespace> \
  --audience="$(oc get authentication cluster -o jsonpath='{.spec.serviceAccountIssuer}')" \
  --duration=1h)

The token audience must match the DataConnectService CR's configured spec.tokenReviewAudiences; a mismatch returns 401 unauthenticated. The list is empty by default, in which case the cluster API server's own audience applies.

2. Send the request

export TENANT_NAMESPACE=dch-example

curl -H "Authorization: Bearer $user_token" \
     -H "x-tenant-id: $TENANT_NAMESPACE" \
     https://dch-rest-dch-services.apps.example.com/api/v1alpha1/data/connections

connections

A connection binds a connection type to credentials stored in a Kubernetes secret and connector-specific properties. Connections are tenant-scoped and require the x-tenant-id header. On create, supply credentials via credentials_ref (reference an existing secret) or credentials (the server creates the secret). On patch, use credentials_ref to point at a different secret; inline credentials in the patch body are silently ignored. The status.state field reflects live connection health. Call /connections/{id}/readiness to refresh it.

List connections

Returns all connections accessible to the tenant identified by x-tenant-id. The response is a DataConnectionResourceList.

Authorizations:
(tenantHeaderbearerAuth)

Responses

Response samples

Content type
application/json
{
  • "total_count": 0,
  • "items": [
    ]
}

Create a connection

Creates a connection that binds a connection type to credentials and connector-specific properties. The referenced connection type must already exist. Use /test/credentials to validate credentials before creating a connection. Returns 400 with credentials_check_failed when inline credentials do not satisfy the connection type schema. For inline credentials, a missing connection type returns 404; for a credentials_ref, it returns 422. When the server cannot create the secret for inline credentials, it returns cannot_create_secret with the Kubernetes error in the message: 409 when the secret already exists, 422 when the secret name or keys are invalid or the tenant namespace does not exist, 503 when the Kubernetes API is unavailable, and 500 for other failures, such as missing RBAC for the DCH service account. Accepts two payload variants (untagged union): use credentials_ref to reference an existing secret, or credentials to supply inline credentials (the server creates the secret automatically).

Authorizations:
(tenantHeaderbearerAuth)
Request Body schema: application/json
required
One of
name
required
string

Display name for the connection.

description
string

Optional free-form description of the connection.

data_connection_type_id
required
string

References a connection type id

format
required
string (DataFormat)
Enum: "tabular" "binary"

Data access format for this connection. tabular — queried with SQL/Flight, returns rows. binary — opaque objects addressed by path.

required
object (CredentialsRef)

Reference to an existing Kubernetes secret containing credentials.

required
object

Connector-specific non-credential configuration (e.g. host, port, bucket). Keys and values are strings.

Responses

Request samples

Content type
application/json
Example
{
  • "name": "my-postgres",
  • "description": "Sales data warehouse",
  • "data_connection_type_id": "550e8400-e29b-41d4-a716-446655440000",
  • "format": "tabular",
  • "credentials_ref": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Get a connection

Returns the full connection resource, including metadata, resource, and status.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Update a connection

Partially updates a connection using JSON Merge Patch (RFC 7396). Supply only the fields you want to change; omitted fields are left unchanged. To change the credentials secret reference, patch credentials_ref. Inline credentials in the patch body are silently ignored.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

Request Body schema: application/merge-patch+json
required
name
string

Display name for the connection.

description
string or null

Free-form description of the connection. Set to null to remove it.

data_connection_type_id
string

References a connection type id.

format
string (DataFormat)
Enum: "tabular" "binary"

Data access format for this connection. tabular — queried with SQL/Flight, returns rows. binary — opaque objects addressed by path.

object (CredentialsRef)

Reference to an existing Kubernetes secret containing credentials.

object

Connector-specific non-credential configuration (e.g. host, port, bucket). Keys and values are strings.

Responses

Request samples

Content type
application/merge-patch+json
{
  • "name": "string",
  • "description": "string",
  • "data_connection_type_id": "string",
  • "format": "tabular",
  • "credentials_ref": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Delete a connection

Permanently deletes the connection. The credentials secret referenced by the connection is not deleted.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request",
  • "message": "Invalid request: missing required field 'name'"
}

Export a connection to a Kubernetes secret

Flattens the connection metadata, properties, and credentials into a single Kubernetes secret with dot-notation keys (e.g. data_connection.name, data_connection.properties.host). If the secret already exists it is overwritten. When the server cannot write the secret, it returns cannot_create_secret with the Kubernetes error in the message: 409 when fields of the existing secret are managed by another client, 422 when the secret name or keys are invalid or the tenant namespace does not exist, 503 when the Kubernetes API is unavailable, and 500 for other failures, such as missing RBAC for the DCH service account.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

secret_name
required
string

Name of the Kubernetes secret to create or overwrite

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request",
  • "message": "Invalid request: missing required field 'name'"
}

Check connection readiness

Validates that the connection's credentials secret exists, matches the connection type schema, and that the data source is reachable. Updates the connection status accordingly. When a credentials secret cannot be read, fails schema validation, or the data-source check fails, the connection status is updated before the error is returned. A missing connection returns 502 without a status update. Returns 400 with invalid_secret or credentials_check_failed when the secret is missing or does not match the connection type schema. Returns 502 with connection_check_failed when the connection is not found or the data source check fails. Returns 500 with status_update_failed when the service cannot persist an updated connection status.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request",
  • "message": "Invalid request: missing required field 'name'"
}

Download binary data from a connection

Streams binary data (files, objects) from a data connection. The path query parameter is connector-specific (for example, an object key or a relative URL path). Only connectors that support binary reads will return data; unsupported connectors respond with 501.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Unique identifier of the connection

query Parameters
path
required
string
Example: path=models/model.bin

File path or object key to download

Responses

Response samples

Content type
application/octet-stream
UEsDBBQAAAAIAmuAAY4AAAACAAADAAAAYPIakvJrKrp5sQ0AiUtzUEgU0zE10y8uzStOASUmqTcEKkxUAAAsAQAA

connection-types

A connection type defines a schema for a data connection. A connection type must be created before creating a connection of that type. Connection types are typically created by the Data Connect Hub operator, but you can also create your own custom connection types. Connection types created by the operator are known as global connection types and are accessible by all tenants. Connection types created by a tenant are only accessible by that tenant.

List connection types

Returns all connection types that are accessible to the tenant. This includes global connection types created by the operator and any custom connection types created by the tenant.

Authorizations:
(tenantHeaderbearerAuth)

Responses

Response samples

Content type
application/json
{
  • "total_count": 0,
  • "items": [
    ]
}

Create a connection type

Default connection types are created by the Data Connect Hub operator. You can also create connection types. Connection types created by a tenant are only accessible by that tenant.

Authorizations:
(tenantHeaderbearerAuth)
Request Body schema: application/json
required
name
required
string

The name of the connection type. This name is unique for connection types of this tenant.

label
string or null

Optional display label for the connection type. When present the UI should render this instead of the short name.

provider
required
string
description
string or null
required
Array of objects (Field)
tags
Array of strings or null[ items non-empty ]

Arbitrary labels for categorising the connection type (e.g. "domain: database", "engine: postgresql").

Responses

Request samples

Content type
application/json
{
  • "name": "PostgreSQL",
  • "label": "PostgreSQL database",
  • "provider": "postgres",
  • "description": "string",
  • "credentials_fields": [
    ],
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Get a connection type

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Resource unique identifier

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Update a connection type

Partially updates a connection type using JSON Merge Patch (RFC 7396). Supply only the fields you want to change; omitted fields are left unchanged.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Resource unique identifier

Request Body schema: application/merge-patch+json
required
name
string
label
string or null
provider
string
description
string or null
Array of objects (Field)
tags
Array of strings or null[ items non-empty ]

Arbitrary labels for categorising the connection type.

Responses

Request samples

Content type
application/merge-patch+json
{
  • "name": "string",
  • "label": "string",
  • "provider": "string",
  • "description": "string",
  • "credentials_fields": [
    ],
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "resource": {
    },
  • "status": {
    }
}

Delete a connection type

Deletes a connection type. The request is rejected with 409 Conflict if any connection still references the type; delete those connections first. Only the number of referencing connections is reported, since a global connection type may be referenced from other tenants.

Authorizations:
(tenantHeaderbearerAuth)
path Parameters
id
required
string

Resource unique identifier

Responses

Response samples

Content type
application/json
{
  • "code": "bad_request",
  • "message": "Invalid request: missing required field 'name'"
}

test

Test operations

Test credentials against a data source

Tests the provided credentials by attempting to connect to the data source without creating any resources. You can use /test/credentials to test the credentials first. Once the test is successful, you can use /connections to create a connection.

Authorizations:
(tenantHeaderbearerAuth)
Request Body schema: application/json
required
data_connection_type_id
required
string

Connection type id to test against

required
object

Credential key-value pairs to test

Responses

Request samples

Content type
application/json
{
  • "data_connection_type_id": "550e8400-e29b-41d4-a716-446655440000",
  • "credentials": {
    }
}

Response samples

Content type
application/json
{
  • "code": "bad_request",
  • "message": "Invalid request: missing required field 'name'"
}

Health check

Application readiness probe. Note this endpoint is directly under the root path, i.e. /health, not under /api.

Responses

Response samples

Content type
application/json
{
  • "service": "Data Connect Hub"
}