For the complete documentation index, see llms.txt. This page is also available as Markdown.

資料庫

建立 SQL 資料庫連線

POST /api/v1/sql-databases/

請求內容

請求參數

欄位
類型
必填
說明

name

string

Display name for this database connection

description

string

Description of the database and its purpose

databaseType

object

Type of database: PostgreSQL, MySQL, MSSQL, Oracle, or MaiAgent postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

Connection string for external databases. Not required for MaiAgent type as it uses the system default.

includeTables

object

Optional list of tables to include. Format: {"tables": ["table1", "table2"]}. For MaiAgent type, this is auto-populated from uploaded files.

isActive

boolean

When disabled, this database will not be used in Text-to-SQL queries

chatbots

array[IdName]

groups

array[IdName]

請求結構範例

{
  "name": string // Display name for this database connection
  "description"?: string // Description of the database and its purpose (非必填)
  "databaseType":  // Type of database: PostgreSQL, MySQL, MSSQL, Oracle, or MaiAgent

* `postgresql` - PostgreSQL
* `mysql` - MySQL
* `maiagent` - MaiAgent
* `oracle` - Oracle
* `mssql` - MSSQL
  {
  }
  "databaseUrl"?: string // Connection string for external databases. Not required for MaiAgent type as it uses the system default. (非必填)
  "includeTables"?: object // Optional list of tables to include. Format: {"tables": ["table1", "table2"]}. For MaiAgent type, this is auto-populated from uploaded files. (非必填)
  "isActive"?: boolean // When disabled, this database will not be used in Text-to-SQL queries (非必填)
  "chatbots"?: [ // 非必填
    {
      "id": string (uuid)
    }
  ]
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
    }
  ]
}

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


列出 SQL 資料庫

GET /api/v1/sql-databases/

參數

參數名稱
必填
類型
說明

databaseType

string

Type of database: PostgreSQL, MySQL, MSSQL, Oracle, or MaiAgent `postgresql`: PostgreSQL ; `mysql`: MySQL ; `maiagent`: MaiAgent ; `oracle`: Oracle ; `mssql`: MSSQL;

isActive

boolean

isExternal

boolean

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

query

string

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


取得特定 SQL 資料庫

GET /api/v1/sql-databases/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


更新 SQL 資料庫

PUT /api/v1/sql-databases/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

請求內容

請求參數

欄位
類型
必填
說明

name

string

Display name for this database connection

description

string

Description of the database and its purpose

databaseUrl

string

Connection string for external databases. Not required for MaiAgent type as it uses the system default.

includeTables

object

Optional list of tables to include. Format: {"tables": ["table1", "table2"]}. For MaiAgent type, this is auto-populated from uploaded files.

isActive

boolean

When disabled, this database will not be used in Text-to-SQL queries

chatbots

array[IdName]

groups

array[IdName]

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


部分更新 SQL 資料庫

PATCH /api/v1/sql-databases/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

請求內容

請求參數

欄位
類型
必填
說明

name

string

Display name for this database connection

description

string

Description of the database and its purpose

databaseUrl

string

Connection string for external databases. Not required for MaiAgent type as it uses the system default.

includeTables

object

Optional list of tables to include. Format: {"tables": ["table1", "table2"]}. For MaiAgent type, this is auto-populated from uploaded files.

isActive

boolean

When disabled, this database will not be used in Text-to-SQL queries

chatbots

array[IdName]

groups

array[IdName]

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


刪除 SQL 資料庫

DELETE /api/v1/sql-databases/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

程式碼範例

回應內容

狀態碼
說明

204

No response body


測試資料庫連線

POST /api/v1/sql-databases/{id}/test-connection/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

請求內容

請求參數

欄位
類型
必填
說明

databaseType

string (enum: postgresql, mysql, maiagent, oracle, mssql)

postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


上傳檔案至資料庫

POST /api/v1/sql-databases/{id}/upload-files/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this SQL Database.

請求內容

請求參數

欄位
類型
必填
說明

files

array[object]

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


批量刪除 SQL 資料庫

POST /api/v1/sql-databases/batch-delete/

請求內容

請求參數

欄位
類型
必填
說明

ids

array[string]

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼
說明

204

No response body


列出資料表

GET /api/v1/sql-databases/{sqlDatabasePk}/tables/

參數

參數名稱
必填
類型
說明

sqlDatabasePk

string

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

query

string

status

string

`pending`: Pending ; `processing`: Processing ; `success`: Success ; `failed`: Failed ; `dropping`: Dropping ; `drop_failed`: Drop Failed;

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


建立資料表

POST /api/v1/sql-databases/{sqlDatabasePk}/tables/

參數

參數名稱
必填
類型
說明

sqlDatabasePk

string

請求內容

請求參數

欄位
類型
必填
說明

tableName

string

Name of the table in the database

description

string

Description of the table and its data for better Text-to-SQL understanding

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


取得特定資料表

GET /api/v1/sql-databases/{sqlDatabasePk}/tables/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table.

sqlDatabasePk

string

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


更新資料表

PUT /api/v1/sql-databases/{sqlDatabasePk}/tables/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table.

sqlDatabasePk

string

請求內容

請求參數

欄位
類型
必填
說明

tableName

string

Name of the table in the database

description

string

Description of the table and its data for better Text-to-SQL understanding

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


部分更新資料表

PATCH /api/v1/sql-databases/{sqlDatabasePk}/tables/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table.

sqlDatabasePk

string

請求內容

請求參數

欄位
類型
必填
說明

tableName

string

Name of the table in the database

description

string

Description of the table and its data for better Text-to-SQL understanding

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


刪除資料表

DELETE /api/v1/sql-databases/{sqlDatabasePk}/tables/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table.

sqlDatabasePk

string

程式碼範例

回應內容

狀態碼
說明

204

No response body


批量刪除資料表

POST /api/v1/sql-databases/{sqlDatabasePk}/tables/batch-delete/

參數

參數名稱
必填
類型
說明

sqlDatabasePk

string

請求內容

請求參數

欄位
類型
必填
說明

ids

array[string]

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼
說明

204

No response body


列出資料欄位

GET /api/v1/sql-databases/{sqlDatabasePk}/tables/{tablePk}/columns/

參數

參數名稱
必填
類型
說明

sqlDatabasePk

string

tablePk

string

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


取得特定資料欄位

GET /api/v1/sql-databases/{sqlDatabasePk}/tables/{tablePk}/columns/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table Column.

sqlDatabasePk

string

tablePk

string

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


更新資料欄位

PUT /api/v1/sql-databases/{sqlDatabasePk}/tables/{tablePk}/columns/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table Column.

sqlDatabasePk

string

tablePk

string

請求內容

請求參數

欄位
類型
必填
說明

columnName

string

columnType

string

Data type of the column (e.g., VARCHAR, INTEGER, TIMESTAMP)

description

string

Description of the column for better Text-to-SQL understanding

isPrimaryKey

boolean

isNullable

boolean

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


部分更新資料欄位

PATCH /api/v1/sql-databases/{sqlDatabasePk}/tables/{tablePk}/columns/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Database Table Column.

sqlDatabasePk

string

tablePk

string

請求內容

請求參數

欄位
類型
必填
說明

columnName

string

columnType

string

Data type of the column (e.g., VARCHAR, INTEGER, TIMESTAMP)

description

string

Description of the column for better Text-to-SQL understanding

isPrimaryKey

boolean

isNullable

boolean

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


測試資料庫連線(通用)

POST /api/v1/database-connection/test/

請求內容

請求參數

欄位
類型
必填
說明

databaseType

object

資料庫類型(不包含 MaiAgent 內部使用類型) postgresql: PostgreSQL ; mysql: MySQL ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

資料庫連線字串

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值

狀態碼: 400

回應結構範例

回應範例值


列出資料庫連線字串範例

GET /api/v1/database-examples/

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值

狀態碼: 401

回應結構範例

回應範例值


取得特定連線字串範例

GET /api/v1/database-examples/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 資料庫連線範例.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


列出 AI 助理的資料庫配置

GET /api/v1/chatbots/{chatbotPk}/databases/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


新增 AI 助理的資料庫配置

POST /api/v1/chatbots/{chatbotPk}/databases/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

請求內容

請求參數

欄位
類型
必填
說明

name

string

顯示用的名稱,例如:主要業務DB、分析DB

databaseType

object

資料庫類型選項,有 MySQL、PostgreSQL、MSSQL、Oracle、MaiAgent postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

資料庫連線字串

includeTables

object

指定要查詢的資料表列表,格式: {"tables": ["table1", "table2"]}。MaiAgent 類型會自動從上傳的檔案中取得,不需要手動設定

isActive

boolean

停用後將不會在 Text-to-SQL 查詢中使用此資料庫

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


取得特定資料庫配置

GET /api/v1/chatbots/{chatbotPk}/databases/{id}/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

id

string

A UUID string identifying this Chatbot 資料庫配置.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


更新資料庫配置

PUT /api/v1/chatbots/{chatbotPk}/databases/{id}/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

id

string

A UUID string identifying this Chatbot 資料庫配置.

請求內容

請求參數

欄位
類型
必填
說明

name

string

顯示用的名稱,例如:主要業務DB、分析DB

databaseType

object

資料庫類型選項,有 MySQL、PostgreSQL、MSSQL、Oracle、MaiAgent postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

資料庫連線字串

includeTables

object

指定要查詢的資料表列表,格式: {"tables": ["table1", "table2"]}。MaiAgent 類型會自動從上傳的檔案中取得,不需要手動設定

isActive

boolean

停用後將不會在 Text-to-SQL 查詢中使用此資料庫

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


部分更新資料庫配置

PATCH /api/v1/chatbots/{chatbotPk}/databases/{id}/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

id

string

A UUID string identifying this Chatbot 資料庫配置.

請求內容

請求參數

欄位
類型
必填
說明

name

string

顯示用的名稱,例如:主要業務DB、分析DB

databaseType

object

資料庫類型選項,有 MySQL、PostgreSQL、MSSQL、Oracle、MaiAgent postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL;

databaseUrl

string

資料庫連線字串

includeTables

object

指定要查詢的資料表列表,格式: {"tables": ["table1", "table2"]}。MaiAgent 類型會自動從上傳的檔案中取得,不需要手動設定

isActive

boolean

停用後將不會在 Text-to-SQL 查詢中使用此資料庫

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


刪除資料庫配置

DELETE /api/v1/chatbots/{chatbotPk}/databases/{id}/

參數

參數名稱
必填
類型
說明

chatbotPk

string

A UUID string identifying this Chatbot ID

id

string

A UUID string identifying this Chatbot 資料庫配置.

程式碼範例

回應內容

狀態碼
說明

204

No response body


Last updated

Was this helpful?