Clear the table

Delete all data in the table but retain the table definition. This operation is irreversible, please confirm the target table.

HTTP
POST $CLOUDSIGMA_API_BASE/catalog/table/truncate

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 object in the database to obtain the target table ID. Prepare the personal access token, target workspace ID, and table ID that can access the target workspace. This operation is irreversible, please confirm the target table.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/table/truncate" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": '"$TABLE_ID"'
  }'

Field

Type

Required

Description

id

integer

Yes

Table ID.

Successful response

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

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

null

When cleared successfully, it is fixed to null.

Error response

JSON
{
  "code": "ErrReadonlySystemDatabase",
  "msg": "数据库不可写"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on