View table column list¶
View the table’s field names, types, whether null values are allowed, default values, and key types.
POST $CLOUDSIGMA_API_BASE/meta/table/column
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Request¶
Replace caller-specific values in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/meta/table/column" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"db_name\":\"$DATABASE\",\"table_name\":\"$TABLE\"}"
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
db_name | string | Required | The name of the database where the table is located. |
table_name | string | Required | The name of the table to query the column definition. |
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 |
|---|---|---|
|
integer |
|
|
array |
Column definition list. |
|
string |
Column name. |
|
string |
Data type. |
|
string |
Whether to allow null values; |
|
string |
Default value; empty string if not set. |
|
string |
Key type. |
|
string |
Column remarks. |
|
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¶
{
"code": 404,
"message": "对象不存在"
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |
Follow-up operations¶
Save the identification of the target item, and then query table information.