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, SynxDB, or MaiAgent postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL ; synxdb: SynxDB;

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, SynxDB, or MaiAgent

* `postgresql` - PostgreSQL
* `mysql` - MySQL
* `maiagent` - MaiAgent
* `oracle` - Oracle
* `mssql` - MSSQL
* `synxdb` - SynxDB
  {
  }
  "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, SynxDB, or MaiAgent `postgresql`: PostgreSQL ; `mysql`: MySQL ; `maiagent`: MaiAgent ; `oracle`: Oracle ; `mssql`: MSSQL ; `synxdb`: SynxDB;

isActive

❌

boolean

isExternal

❌

boolean

page

❌

integer

A page number within the paginated result set.

pageSize

❌

integer

Number of results to return per page.

pagination

❌

boolean

Set to false to return all databases without pagination (defaults to true).

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, synxdb)

是

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

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 ; synxdb: SynxDB;

databaseUrl

string

是

資料庫連線字串

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值

狀態碼: 400

回應結構範例

回應範例值


列出資料庫連線字串範例

GET /api/v1/database-examples/

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值

狀態碼: 401

回應結構範例

回應範例值


取得特定連線字串範例

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

參數

參數名稱
必填
類型
說明

id

✅

string

A UUID string identifying this Database Connection Example.

程式碼範例

回應內容

狀態碼: 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

是

Display name, for example: Main Business DB, Analytics DB.

databaseType

object

是

Database type: MySQL, PostgreSQL, MSSQL, Oracle, SynxDB, or MaiAgent. postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL ; synxdb: SynxDB;

databaseUrl

string

是

Database connection string.

includeTables

object

否

Tables to query, formatted as {"tables": ["table1", "table2"]}. The MaiAgent type reads them from uploaded files automatically, so no manual setup is needed.

isActive

boolean

否

When inactive, this database is not used for Text-to-SQL queries.

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 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 Database Configuration.

程式碼範例

回應內容

狀態碼: 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 Database Configuration.

請求內容

請求參數

欄位
類型
必填
說明

name

string

是

Display name, for example: Main Business DB, Analytics DB.

databaseType

object

是

Database type: MySQL, PostgreSQL, MSSQL, Oracle, SynxDB, or MaiAgent. postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL ; synxdb: SynxDB;

databaseUrl

string

是

Database connection string.

includeTables

object

否

Tables to query, formatted as {"tables": ["table1", "table2"]}. The MaiAgent type reads them from uploaded files automatically, so no manual setup is needed.

isActive

boolean

否

When inactive, this database is not used for Text-to-SQL queries.

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 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 Database Configuration.

請求內容

請求參數

欄位
類型
必填
說明

name

string

否

Display name, for example: Main Business DB, Analytics DB.

databaseType

object

否

Database type: MySQL, PostgreSQL, MSSQL, Oracle, SynxDB, or MaiAgent. postgresql: PostgreSQL ; mysql: MySQL ; maiagent: MaiAgent ; oracle: Oracle ; mssql: MSSQL ; synxdb: SynxDB;

databaseUrl

string

否

Database connection string.

includeTables

object

否

Tables to query, formatted as {"tables": ["table1", "table2"]}. The MaiAgent type reads them from uploaded files automatically, so no manual setup is needed.

isActive

boolean

否

When inactive, this database is not used for Text-to-SQL queries.

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 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 Database Configuration.

程式碼範例

回應內容

狀態碼
說明

204

No response body


最後更新於

這有幫助嗎?