Create SQL workbook¶
Create a SQL workbook that holds SQL content and its versions. After success, save the returned workbook_id for creating and managing versions.
POST $CLOUDSIGMA_API_BASE/workbook/create
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
$WORKBOOK_NAME in the example below is the name of the saved record.
Request¶
Replace caller-specific values in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/workbook/create" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"name\": \"$WORKBOOK_NAME\"
}"
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Required | The name of the saved record. |
Successful response¶
data.workbook_id is the ID of the newly saved record, and data.name is the record name. After saving workbook_id, first View SQL saved record version to obtain the version ID; when you need to add an editable version, then Create SQL draft version.
{
"code": 200,
"data": {
"workbook_id": "workbook-123",
"name": "销售分析"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Create a new SQL ID to save the record. |
|
string |
The name of the saved record. |
Error response¶
{
"code": 400,
"message": "请求参数无效"
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |
Follow-up operations¶
Logging data.workbook_id. First View the version of the SQL saved record to obtain version_id, and then use the two IDs to View the version content of the saved SQL.