POST/datasources

Create Datasource

This endpoint creates a Datasource.

Path parameters

None.

Authorization

Request body

  • Name
    name
    Type
    string
    Required
    Description

    Provide a unique name for the Datasource.

  • Name
    description
    Type
    string
    Required
    Description

    Provide a description for the Datasource, which is used by the Mind to decide the relevant datasources for each question.

  • Name
    engine
    Type
    array
    Required
    Description

    Provide a datasource engine. See available engines here.

  • Name
    connection_data
    Type
    array
    Required
    Description

    Provide connection parameters for the selected engine. See available engines and connection parameters here.

  • Name
    tables
    Type
    array
    Description

    This is an optional parameter that lets you specify tables that can be accessed by the Mind.

Request

POST
/datasources
curl --request POST \
--url 'https://mdb.ai/api/datasources' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer MINDS_API_KEY' \
--data '{
"name": "datasource_name",
"engine": "postgres",
"connection_data": {
    "user": "demo_user",
    "password": "demo_password",
    "host": "samples.mindsdb.com",
    "port": "5432",
    "database": "demo",
    "schema": "demo_data"
},
"tables": ["house_sales"],
"description": "House sales data"
}'

Response

200 OK


GET/datasources

List Datasources

This endpoint lists all connected Datasources.

Path parameters

None.

Authorization

Request body

None.

Request

GET
/datasources
curl --request GET \
--url 'https://mdb.ai/api/datasources' \
--header 'Authorization: Bearer MINDS_API_KEY'

Response

[
    {
        "connection_data": {
            "database": "demo",
            "host": "samples.mindsdb.com",
            "password": "demo_password",
            "port": "5432",
            "schema": "demo_data",
            "user": "demo_user"
        },
        "description": "House sales data",
        "engine": "postgres",
        "name": "my_datasource",
        "tables": ["house_sales"],
    },
    ...
]


GET/datasources/{datasource_name}

Get Datasource

This endpoint lists details about a Datasource.

Path parameters

  • Name
    datasource_name
    Type
    string
    Required
    Description

    Provide the name of the Datasource.

Authorization

Request body

  • Name
    check_connection
    Type
    string
    Description

    Set this value to true to check the connection to the data source.

Request

GET
/datasources/{datasource_name}
curl --request GET \
--url 'https://mdb.ai/api/datasources/datasource_name?check_connection=true' \
--header 'Authorization: Bearer MINDS_API_KEY'

Response

{
    "connection_data": {
        "database": "demo",
        "host": "samples.mindsdb.com",
        "password": "demo_password",
        "port": "5432",
        "schema": "demo_data",
        "user": "demo_user"
    },
    "description": "House sales data",
    "engine": "postgres",
    "name": "my_datasource",
    "tables": ["house_sales"],
}


PATCH/datasources/{datasource_name}

Update Datasource

This endpoint updates the Datasource's description and/or connection parameters and/or list of tables.

Path parameters

  • Name
    datasource_name
    Type
    string
    Required
    Description

    Provide the name of the Datasource.

Authorization

Request body

  • Name
    description
    Type
    string
    Description

    Provide a new description for the Datasource, which is used by the Mind to decide the relevant datasources for each question.

  • Name
    connection_data
    Type
    array
    Description

    Provide the updated connection parameters for the selected engine. See available engines and connection parameters here.

  • Name
    tables
    Type
    array
    Description

    This is an optional parameter that lets you specify tables that can be accessed by the Mind.

Request

PATCH
/minds/{mind_name}/datasources
curl --request PATCH \
--url 'https://mdb.ai/api/datasources/datasource_name' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer MINDS_API_KEY' \
--data '{
    "connection_data": {
        "user": "demo_user",
        "password": "demo_password",
        "host": "samples.mindsdb.com",
        "port": "5432",
        "database": "demo",
        "schema": "demo_data"
    },
    "tables": ["sales_data"],
    "description": "Sales data" 
}'

Response

200 OK


DELETE/datasources/{datasource_name}

Delete Datasource

This endpoint deletes a Datasource.

Path parameters

  • Name
    datasource_name
    Type
    string
    Required
    Description

    Provide the name of the Datasource.

Authorization

Request body

None.

Request

DELETE
/datasources/{datasource_name}
curl --request DELETE \
--url https://mdb.ai/api/datasources/datasource_name \
--header 'Authorization: Bearer MINDS_API_KEY'

Response

200 OK

Was this page helpful?