Create file¶
Associates one or more existing file records to the specified volume.
POST $CLOUDSIGMA_API_BASE/catalog/file/create
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First upload the file to obtain the file ID, and query the object in the database to obtain the target volume ID]. Prepare the personal access token, target workspace ID, target volume ID, and file ID that can access the target workspace.
Request body¶
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/file/create" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"volume_id": '"$VOLUME_ID"',
"file_ids": ["'"$FILE_ID"'"]
}'
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Target volume ID. |
|
array[string] |
Yes |
List of file IDs to associate. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
null |
It is fixed to |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |