Finalize SQL version

Save and finalize a SQL version. This interface still covers SQL in the final version.

HTTP
POST $CLOUDSIGMA_API_BASE/workbook/version/save

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.

  1. Prepare personal access token and target workspace ID that can access the target workspace. The token must have updated version permissions.

  2. Query the SQL workbook list, select and record the workbook ID.

  3. Query the SQL workbook version list, select the version with the status of draft (draft), and record the version ID.

When you need to keep the original SQL, create a new draft.

Request body

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $WORKBOOK_ID, $VERSION_ID in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workbook/version/save" \
  -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\"
  }"

When sql_content is omitted or null the old text is retained and an explicit empty string is cleared. Repeated saves still update the version and parent workbook time. Saving does not verify the SQL syntax and does not execute the SQL.

This interface can also re-finalize an already finalized version and overwrite the SQL in it. Update SQL draft version only allows draft modification.

Parameter

Type

Required

Description

workbook_id

string

Yes

The ID of the SQL workbook.

version_id

string

Yes

The version ID of the SQL workbook to be finalized.

sql_content

string or null

No

When omitted or null, the original SQL is retained. Empty strings are cleared. Saving does not execute SQL, nor does it verify SQL syntax.

Successful response

JSON
{
  "code": 200,
  "data": null
}

Field

Type

Description

code

integer

200 on success.

data

null

Fixed to null when finalized successfully.

Error response

JSON
{
  "code": 400,
  "message": "请求参数无效"
}

Field

Type

Description

code

integer or string

Error code or status code.

message

string

error message.

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

400

Invalid request field, workspace, or operation precondition.

Fix the request parameters and submit again.

401

Unauthorized, ErrServiceUnavailable, ErrIAMExplicitRoleInvalid

Missing or invalid authentication credentials.

Check the credential type, expiration, and authentication header.

403

403

The current identity or active role does not have permission for this operation.

Use an authorized identity or contact an administrator to grant access.

404

404

The target object or required reference was not found.

Verify the object identifier, workspace, and current status.

409

409

Conflict in resource state, request payload, or concurrent modification.

Re-read the current state and version, then handle according to the latest result.

500

500

Internal processing failed; write operations may have been partially applied.

Retain request and trace details, and verify the current state before retrying.

503

503

A business, runtime, or authorization dependency is temporarily unavailable.

After the dependency recovers, check existing results first instead of blindly repeating writes.

Last updated on