Download file¶
Get the download address of the temporary file. This interface only returns the download path, not the file content.
POST $CLOUDSIGMA_API_BASE/connectors/file/download
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Set the operation-specific values used in the request:
$CONN_FILE_ID: Temporary file ID obtained after uploading or previewing, passed throughconn_file_id.$DOWNLOAD_PATH: The relative download path returned by this interface, used for subsequent download file streams.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/connectors/file/download" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"conn_file_id\": \"$CONN_FILE_ID\"
}"
Request body
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The ID of the temporary file to download. |
Successful response¶
On success, 200 and the relative download path are returned, but the file content is not returned.
{
"code": "OK",
"msg": "OK",
"data": {
"url": "/v5/connectors/file/stream?conn_file_id=conn_file_01"
}
}
curl -L "${CLOUDSIGMA_API_BASE%/v5}$DOWNLOAD_PATH" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-o ./downloaded-file
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Relative download path, not file content. Append this path to the regional origin (the API base URL without |
Use the returned path to download the file stream and carry the same authentication request header as this interface:
Error response¶
{
"code": "ErrParamInvalid",
"msg": "invalid file identifier",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The JSON request body is invalid; the interface returns this type of error in this status. |
Check the HTTP status and |
|
|
|
Reupload the file, or confirm the temporary file ID. |
|
|
The access token is invalid or has expired. |
Try again after updating the access token. |
|
|
The caller does not have permission to access the temporary file. |
Check workspace ID and access permissions. |
|
|
The service is temporarily unable to generate a download path. |
Keep the desensitization error message and try again. |
Follow-up operations¶
When the temporary file is no longer needed, use conn_file_id to delete the file.