View SQL workbook list¶
Lists the SQL save records that can be read by the current access credentials. The workbook_id in each item can be used to view the version, modify the name, or delete the record.
POST https://moi.matrixorigin.cn/newmoi/workbook/list
Preparation before calling¶
Prepare a personal access token and workspace ID that has access to the workspace. $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.
At most 100 records are returned each time; 20 records 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.
searchstring- Search by name.
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/list" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"page_size": 20
}'
Successful response¶
data.result is the record list of saved SQL, and data.total is the total number of matches. The workbook_id in each item can be used to later view the version, modify the name, or delete the record.
{
"code": 200,
"data": {
"total": 1,
"result": [
{
"workbook_id": "workbook-123",
"name": "销售分析"
}
],
"next_page_token": ""
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
The total number of records matched by the current query. |
|
array |
Record list of saved SQL. |
|
string |
ID of SQL saved record. |
|
string |
The name of the saved record. |
|
string |
Next page mark; if empty, there will be no next page. |
In field paths, [] denotes each item in an array. For example, items[].name is the name field of each item in the items array.
Error response¶
codeinteger or string- Error code or status.
messagestring- Error message.
Error response example
{
"code": 400,
"message": "请求参数无效"
}
Follow-up operations¶
Save the identifier of the target item, and then View the saved SQL version content.