Create SQL draft version

Creates an editable draft version of a SQL save record and saves the original SQL content.

HTTP
POST $CLOUDSIGMA_API_BASE/workbook/version/create

Before you call this API

Configure the regional API endpoint and authentication, and select the target workspace.

First create a saved SQL record to obtain its workbook_id.

$WORKBOOK_ID in the example below is the ID of the SQL saved record. sql_content only saves the SQL content and does not execute the SQL.

Request

Replace caller-specific values in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workbook/version/create" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{
    \"workbook_id\": \"$WORKBOOK_ID\",
    \"sql_content\": \"SELECT 1\"
  }"

Request body

ParameterTypeRequiredDescription
workbook_idstringRequiredThe ID of the SQL saved record.
sql_contentstringDraft SQL content.

Successful response

data.id is the new draft version ID. After saving the ID, you can update draft version or final version.

JSON
{
  "code": 200,
  "data": {
    "id": "version-123",
    "version": "v1",
    "status": "draft"
  }
}

The response fields are as follows.

Field

Type

Description

data.id

string

New draft version ID.

data.version

string

Version name.

data.status

string

New version status, which is draft.

Error response

JSON
{
  "code": 500,
  "message": "Internal server error"
}
FieldTypeDescription
codeinteger or stringError code or status.
messagestringError message.

Follow-up operations

Log data.id. Use this ID View saved SQL version content to confirm the save result.

Last updated on