View SQL workbook version list¶
List all versions of a SQL workbook. Use the returned version_id to view the content, update a draft, or finalize the version.
POST https://moi.matrixorigin.cn/newmoi/workbook/version/list
Preparation before calling¶
Prepare the personal access token, workspace ID, and SQL save record ID. $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.
$WORKBOOK_ID in the example below is the SQL save record ID of the version you want to view. At most 100 versions are returned at a time; 20 are returned when page_size is not specified. When the next_page_token in the response is not empty, fill the value into the page_token of the next request as it is; when it is empty, it means that the last page has been reached.
Request body¶
Replace caller-specific values in the example with actual values.
workbook_idstringRequired- The ID of the SQL saved record.
page_sizeinteger- Number per page, ranging from `1` to `100`; if not passed, it is `20`.
page_tokenstring- Next page token.
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/workbook/version/list" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"workbook_id\": \"$WORKBOOK_ID\"
}"
Successful response¶
data.result is the version list. status means draft means editable draft, finalize means finalized and read-only.
{
"code": 200,
"data": {
"total": 1,
"result": [
{
"id": "version-123",
"name": "v1",
"status": "draft"
}
],
"next_page_token": ""
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
The total number of versions of the current SQL saved records. |
|
array |
Version list. |
|
string |
Version ID. |
|
string |
Version name. |
|
string |
Version status: |
|
string |
Next page mark; if empty, there will be no next page. |
In this document, [] after a type denotes an array. In a field path, [] denotes each item in an array; for example, data.result[].id is the id field of each item in the data.result array.
Error response¶
codeinteger or string- Error code or status.
messagestring- Error message.
Error response example
{
"code": 404,
"message": "SQL 工作簿不存在"
}
Follow-up operations¶
Save the identifier of the target item, and then View SQL workbook version content.