Create folder¶
Create a folder under a volume or existing folder.
POST $CLOUDSIGMA_API_BASE/catalog/folder/create
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the object in the database to obtain the parent volume or parent folder ID.
Set the operation-specific values used in the request:
$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¶
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/folder/create" \
-H "X-API-Key: $CLOUDSIGMA_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.