Upload files¶
Upload a file that is not associated with a volume. After uploading, you can associate it to the volume through Associate file to volume.
POST $CLOUDSIGMA_API_BASE/catalog/file/upload
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.
Use multipart/form-data request. Prepare a personal access token and target workspace ID that can access the target workspace.
Request parameters¶
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/file/upload" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-F "file=@./orders.csv"
form fields
Field |
Type |
Required |
Description |
|---|---|---|---|
|
file |
Yes |
The local file to upload. |
32 MiB is the memory threshold for upload parsing, not the file size limit. The service first creates the file record and then writes the file content. When writing fails, file records may remain.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"file_id": "file-123"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
The file ID generated after uploading. Can be used to create file requests. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "缺少 file 字段"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |