Query objects in the database¶
Query the volumes, tables and operators that can be read in the specified database. These objects match Volume, Table, and Operator in the console database create menu.
POST https://moi.matrixorigin.cn/newmoi/catalog/database/children
Preparation before calling¶
First query the database list to obtain the target database ID. Prepare the personal access token, target workspace ID, and database ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$DATABASE_ID: The database ID of the child object is to be queried.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/database/children" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": '"$DATABASE_ID"'
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Database ID. |
Successful response¶
On success, returns 200 and a list of sub-objects readable by the current identity.
{
"code": "OK",
"msg": "OK",
"data": {
"list": [
{
"id": 10,
"name": "raw",
"type": "volume",
"children_count": 2,
"size": 1024,
"description": "原始文件",
"reserved": false,
"allowed_actions": ["volume.read"]
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object[] |
List of sub-objects; empty array when there is no readable object. |
|
integer or string |
Object ID. |
|
string |
Object name. |
|
string |
Object type: |
|
integer |
Number of children; returned if applicable. |
|
integer |
Storage size; returned if applicable. |
|
string |
Creation time; returned if applicable. |
|
string |
Creator ID; returned when applicable. |
|
string |
Update time; returned when applicable. |
|
string |
Updater ID; returned if applicable. |
|
string |
Object description. |
|
string |
Object display name; returned when applicable. |
|
string |
Object display description; returned when applicable. |
|
boolean |
Whether it is a reserved object. |
|
boolean |
Whether it is a publishing object; returned when applicable. |
|
boolean |
Whether it is a subscription object; returned when applicable. |
|
string[] |
Operations allowed by the current identity. |
In this document, [] after a type means an array; for example, object[] is an array of objects. In field paths, [] means each item in an array; for example, data.list[].id is the id field of each item in data.list.
Error response¶
{
"code": "ErrObjectNotFound",
"msg": "数据库不存在",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body or database ID is invalid. |
Use a positive integer ID from the database list. |
|
|
The current identity does not have read permission. |
Requesting permission to |
|
|
The database does not exist or is not readable. |
Verify database ID and workspace. |
|
|
The server failed to read the sub-object. |
Try again later. |
Follow-up operations¶
Save data.list[].id. When the type is volume, Query volume details. When the type is table, Query table information. When the type is function, Query custom operator details.