Create file

Associates one or more existing file records to the specified volume.

HTTP
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

Shell
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

volume_id

integer

Yes

Target volume ID.

file_ids

array[string]

Yes

List of file IDs to associate.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": null
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

null

It is fixed to null when the association is successful.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on