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¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region.
Prepare personal access token and target workspace ID that can access the target workspace.
View database, select the database name.
Query the table and view list in the database and select the table name.
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $DATABASE, $TABLE 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\"
}"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The name of the database where the table resides. |
|
string |
Yes |
The name of the table to view column definitions. |
Successful response¶
{
"code": 200,
"data": {
"columns": [
{
"name": "id",
"data_type": "INT",
"nullable": "NO",
"default_value": "",
"key_type": "PRI",
"comment": ""
}
],
"total": 1
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
200 on success. |
|
object |
Table column definitions. |
|
array of objects or null |
List of column definitions. It is null if there is no column record. |
|
integer |
Number of columns. |
|
string |
Column name. |
|
string |
Data type. |
|
string |
Whether to allow null values. YES means allowed, NO means not allowed. |
|
string |
Default value string. SQL NULL and the true empty string default both return an empty string and cannot be distinguished by this field. |
|
string |
Key type. |
|
string |
Column notes. |
Error response¶
{
"code": 404,
"message": "对象不存在"
}
Field |
Type |
Description |
|---|---|---|
|
integer or string |
Error code or status code. |
|
string |
error message. |