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.

HTTP
POST $CLOUDSIGMA_API_BASE/workbook/version/list

Before you call this API

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

$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

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

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

Request body

ParameterTypeRequiredDescription
workbook_idstringRequiredThe ID of the SQL saved record.
page_sizeintegerNumber per page, ranging from `1` to `100`; if not passed, it is `20`.
page_tokenstringNext page token.

Successful response

data.result is the version list. status means draft means editable draft, finalize means finalized and read-only.

JSON
{
  "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

data.total

integer

The total number of versions of the current SQL saved records.

data.result

array

Version list.

data.result[].id

string

Version ID.

data.result[].name

string

Version name.

data.result[].status

string

Version status: draft means editable draft; finalize means finalized, read-only.

data.next_page_token

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

JSON
{
  "code": 404,
  "message": "SQL 工作簿不存在"
}
FieldTypeDescription
codeinteger or stringError code or status.
messagestringError message.

Follow-up operations

Save the identifier of the target item, and then View SQL workbook version content.

Last updated on