Update SQL draft version¶
Modifying the SQL content saved in the draft version will not execute the SQL. The finalized version cannot be modified.
POST $CLOUDSIGMA_API_BASE/workbook/version/update
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First list saved SQL versions and confirm the version status.
$WORKBOOK_ID in the example below is the ID of the SQL saved record and $VERSION_ID is the version ID with status draft.
Request¶
Replace caller-specific values in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/workbook/version/update" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"workbook_id\": \"$WORKBOOK_ID\",
\"version_id\": \"$VERSION_ID\",
\"sql_content\": \"SELECT 1\"
}"
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
workbook_id | string | Required | The ID of the SQL saved record. |
version_id | string | Required | The version ID of the SQL save record with status `draft`. |
sql_content | string | The SQL content to be saved. |
Successful response¶
data is empty on success. You can then View the saved SQL version content to confirm the saved SQL content.
{
"code": 200,
"data": null
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
null |
Fixed to |
Error response¶
{
"code": 404,
"message": "SQL 工作簿或版本不存在"
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |
Follow-up operations¶
Use the same resource identifier View saved SQL version content to confirm the update result.