Finalize SQL version¶
Save and finalize a draft version. After finalization this version is read-only and the SQL text cannot be updated.
POST https://moi.matrixorigin.cn/newmoi/workbook/version/save
Preparation before calling¶
Prepare your personal access token with update permissions, workspace ID, SQL save record ID, and draft version ID to be finalized. $AI_STUDIO_API_KEY is the personal access token used as the value of the X-API-Key request header; $WORKSPACE_ID is the target workspace ID used as the value of the X-Workspace-ID request header. You can first View saved SQL version to 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. If you need to modify the finalized SQL, create a new draft version.
Request body¶
Replace caller-specific values in the example with actual values.
workbook_idstringRequired- The ID of the SQL saved record.
version_idstringRequired- The version ID in the SQL save record to be finalized.
sql_contentstring- SQL content saved together when finalizing.
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/workbook/version/save" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"workbook_id\": \"$WORKBOOK_ID\",
\"version_id\": \"$VERSION_ID\"
}"
Successful response¶
data is empty on success. You can then View the version of the saved SQL to confirm that this version of status is finalize.
{
"code": 200,
"data": null
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
null |
Fixed to |
Error response¶
codeinteger or string- Error code or status.
messagestring- Error message.
Error response example
{
"code": 400,
"message": "请求参数无效"
}
Follow-up operations¶
After completion View saved SQL version content confirms the current status.