View table column list

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

HTTP
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.

  1. Prepare personal access token and target workspace ID that can access the target workspace.

  2. View database, select the database name.

  3. 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.

Shell
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

db_name

string

Yes

The name of the database where the table resides.

table_name

string

Yes

The name of the table to view column definitions.

Successful response

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

Field

Type

Description

code

integer

200 on success.

data

object

Table column definitions.

data.columns

array of objects or null

List of column definitions. It is null if there is no column record.

data.total

integer

Number of columns.

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 string. SQL NULL and the true empty string default both return an empty string and cannot be distinguished by this field.

data.columns[].key_type

string

Key type.

data.columns[].comment

string

Column notes.

Error response

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

Field

Type

Description

code

integer or string

Error code or status code.

message

string

error message.

Last updated on