Clear the table¶
Delete all data in the table but retain the table definition. This operation is irreversible, please confirm the target table.
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¶
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 |
|---|---|---|---|
|
integer |
Yes |
Table ID. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
null |
When cleared successfully, it is fixed to |
Error response¶
{
"code": "ErrReadonlySystemDatabase",
"msg": "数据库不可写"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |