Create volume¶
Create a root volume under the specified database.
POST https://moi.matrixorigin.cn/newmoi/catalog/volume/create
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 parent database ID under which the volume is to be created.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/volume/create" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"database_id": '"$DATABASE_ID"',
"name": "<VOLUME_NAME>",
"description": "<VOLUME_DESCRIPTION>"
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
The parent database ID. |
|
string |
Yes |
Volume name, must be a valid identifier. |
|
string |
No |
Volume description. |
Successful response¶
Returns 200 and the new volume ID on success. This response indicates that the volume has been created.
{
"code": "OK",
"msg": "OK",
"data": {
"id": 789
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
integer |
ID of the new volume. |
Error response¶
{
"code": "ErrAlreadyExists",
"msg": "对象已存在",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Check the target database ID and volume name. |
|
|
The current identity does not have permission to create volumes in the target database. |
Use credentials with write access, or contact your administrator for authorization. |
|
|
The target database is not writable. |
Select a writable database. |
|
|
A volume with the same name already exists in the target database. |
Use a different volume name. |
|
|
The service cannot create the volume. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
Use data.id Query volume details.