View table column list

View the table’s field names, types, whether null values are allowed, default values, and key types.

POST https://moi.matrixorigin.cn/newmoi/meta/table/column

Preparation before calling

Prepare your personal access token, workspace ID, database name, and table name.

The examples below use $AI_STUDIO_API_KEY, $WORKSPACE_ID, $DATABASE, and $TABLE.

Request body

Replace caller-specific values in the example with actual values.

db_namestringRequired
The name of the database where the table is located.
table_namestringRequired
The name of the table to query the column definition.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/meta/table/column" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{\"db_name\":\"$DATABASE\",\"table_name\":\"$TABLE\"}"

Successful response

{
  "code": 200,
  "data": {
    "columns": [{"name": "id", "data_type": "INT", "nullable": "NO", "default_value": "", "key_type": "PRI", "comment": ""}],
    "total": 1
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

200 on success.

data.columns

array

Column definition list.

data.columns[].name

string

Column name.

data.columns[].data_type

string

Data type.

data.columns[].nullable

string

Whether to allow null values; YES means allowed, NO means not allowed.

data.columns[].default_value

string

Default value; empty string if not set.

data.columns[].key_type

string

Key type.

data.columns[].comment

string

Column remarks.

data.total

integer

Number of columns.

In field paths, [] denotes each item in an array. For example, items[].name is the name field of each item in the items array.

Error response

codeinteger or string
Error code or status.
messagestring
Error message.

Error response example

{
  "code": 404,
  "message": "对象不存在"
}

Follow-up operations

Save the identification of the target item, and then query table information.

Last updated on