Skip to main content
POST
/
curl --request POST \
    --url https://api.brewit.ai/v2/datasets/3fa85f64-5717-4562-b3fc-2c963f66afa6/resources \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer access-token' \
    --data '{
        "name": "resource name",
        "description": "resource description",
        "type": "db:postgres",
        "db_credentials": {...}
    }'
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "resource name",
    "description": "resource description",
    "type": "db:postgres",
    "db_credentials": {...},
    "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "owner_id": 1,
    "created_at": "2024-01-02T03:04:05.000000",
    "updated_at": "2024-01-02T03:04:05.000000"
}
curl --request POST \
    --url https://api.brewit.ai/v2/datasets/3fa85f64-5717-4562-b3fc-2c963f66afa6/resources \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer access-token' \
    --data '{
        "name": "resource name",
        "description": "resource description",
        "type": "db:postgres",
        "db_credentials": {...}
    }'
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "resource name",
    "description": "resource description",
    "type": "db:postgres",
    "db_credentials": {...},
    "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "owner_id": 1,
    "created_at": "2024-01-02T03:04:05.000000",
    "updated_at": "2024-01-02T03:04:05.000000"
}
dataset_id
string
required
The identifier of the dataset (workspace) to which the resource belongs.

Body Parameters

name
string
required
The name of the resource to display in the Brewit UI.
description
string
The description of the resource to display in the Brewit UI.
type
enum
required
The type of resource you are connecting to. Currently, we support: db:mysql (MySQL), db:postgres (PostgreSQL), dw:bigquery (BigQuery), dw:snowflake (Snowflake).
db_credentials
object
required
The credentials to connect to the resource. We will store the credentials securely and only display the insensitive fields (e.g. host, port, etc.) in the response.
{
    "username": "username",
    "password": "password",
    "host": "host",
    "port": 3306,
    "dbname": "database name"
}
{
    "username": "username",
    "password": "password",
    "host": "host",
    "port": 5432,
    "dbname": "database name"
}
You should extract the JSON from the service account key file downloaded from the Google Cloud Console.
{
    "type": "service_account",
    "project_id": "project_id",
    "private_key_id": "private_key_id",
    "private_key": "private_key",
    "client_email": "client_email",
    "client_id": "client_id",
    "auth_uri": "auth_uri",
    "token_uri": "token_uri",
    "auth_provider_x509_cert_url": "auth_provider_x509_cert_url",
    "client_x509_cert_url": "client_x509_cert_url"
}
{
    "account": "account",
    "user": "user",
    "password": "password",
    "warehouse": "warehouse",
    "database": "database",
    "role": "role",
}