Download file¶
Download file contents.
POST $CLOUDSIGMA_API_BASE/catalog/file/download
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the file list to obtain the target file ID.
Set the operation-specific values used in the request:
$FILE_ID: File ID to download.
Request¶
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
Request body
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
File ID, cannot be empty. |
|
string |
No |
Volume ID. |
|
boolean |
No |
Whether to download in ZIP format. |
Successful response¶
Returns 200 and the file contents on success. The response body is not in JSON format.
When a filename is available, the response header Content-Disposition specifies the attachment to download and provides the filename. When no content type is provided, Content-Type is application/octet-stream.
Response items |
Description |
|---|---|
HTTP status code |
|
|
File MIME type; |
|
Attachment download when filename is available. |
Response body |
File content. |
Error response¶
When the download fails before it starts, an error message in JSON format is returned:
{
"code": "ErrParamInvalid",
"msg": "file_id 不能为空",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Pass in a valid file ID. |
|
|
The current identity does not have read permission on the root volume to which it belongs. |
Use credentials with read access, or contact your administrator for authorization. |
|
|
File does not exist. |
Check file ID. |
|
|
The service cannot open the download stream. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
If you need to continue management after the download is completed, return to Query Catalog details.