Create folder¶
Create a folder under a volume or existing folder.
POST https://moi.matrixorigin.cn/newmoi/catalog/folder/create
Preparation before calling¶
First query the object in the database to obtain the parent volume or parent folder ID. Prepare a personal access token with access to the target workspace, the target workspace ID, and the parent volume or parent folder ID.
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.$VOLUME_ID: Parent volume or parent folder ID; the service resolves this to the root volume.
The caller needs write access to the root volume.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/folder/create" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"parent_volume_id": '"$VOLUME_ID"',
"database_id": '"$DATABASE_ID"',
"name": "<FOLDER_NAME>",
"description": "<FOLDER_DESCRIPTION>"
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
The parent volume or parent folder ID; the service resolves this to the root volume. |
|
integer |
Yes |
Database ID. |
|
string |
Yes |
Folder name, must be a valid identifier. |
|
string |
No |
Folder description. |
Successful response¶
Returns 200 and the new folder ID on success. The caller needs write access to the root volume and the parent database.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "901"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
ID of the newly created folder, returned as a numeric string. When calling subsequent endpoints that require an integer ID, use this numeric value itself. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "name 无效",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Check parent object ID and folder name. |
|
|
The current identity does not have write permissions to the root volume. |
Use credentials with write access, or contact your administrator for authorization. |
|
|
The database where the target volume is located is not writable. |
Select a writable volume. |
|
|
The service cannot create the folder. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
Log data.id. Use this ID to Query Catalog details to confirm the saving result.