Download file

Download file contents.

HTTP
POST $CLOUDSIGMA_API_BASE/catalog/file/download

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 query the file list to obtain the target file ID. Prepare the personal access token, target workspace ID, and file ID that can access the target workspace.

The file must be mounted and the root volume to which it belongs can be determined. Files that are not mounted or belong to multiple root volumes may not be downloaded. Passing in volume_id also cannot bypass this restriction.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/file/download" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "file_id": "'"$FILE_ID"'"
  }' \
  -o ./downloaded-file

Field

Type

Required

Description

file_id

string

Yes

File ID, cannot be empty.

volume_id

string

No

Currently does not participate in this interface processing. Permissions are verified against the actual root volume corresponding to file_id.

as_zip

boolean

No

Whether to download as ZIP.

Successful response

HTTP
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: inline 或 attachment

[文件内容]

Field

Type

Description

HTTP 状态码

HTTP status

200。

Content-Type

HTTP Header

File MIME type. application/octet-stream when not provided.

Content-Disposition

HTTP Header

Download attachment when filename is available.

响应体

binary

File content.

Error response

When the download fails before it starts, an error message in JSON format is returned:

JSON
{
  "code": "ErrParamInvalid",
  "msg": "file_id 不能为空"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on