Check if the table exists

Checks whether the given table name exists in the specified database.

HTTP
POST $CLOUDSIGMA_API_BASE/catalog/table/exist

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. First query the database list to obtain the target database ID. Prepare the personal access token, target workspace ID, and database ID that can access the target workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/table/exist" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "database_id": '"$DATABASE_ID"',
    "name": "<TABLE_NAME>"
  }'

Field

Type

Required

Description

database_id

integer

Yes

Database ID.

name

string

Yes

The name of the table to check.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "data": true
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

Existence check results.

data.data

boolean

true indicates that the table exists, and false indicates that the table does not exist.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on