Upload files¶
Upload a file that is not associated with a volume. Once uploaded, it can be associated to the volume via Create file.
POST $CLOUDSIGMA_API_BASE/catalog/file/upload
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Use multipart/form-data request.
Request¶
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. |
Successful response¶
Returns 200 and file_id on success. This request only uploads the file and does not associate it with a volume.
{
"code": "OK",
"msg": "OK",
"data": {
"file_id": "file-123"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
File ID generated after upload; can be used for Create file request. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "缺少 file 字段",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Resubmit using |
|
|
The current identity does not have upload permission. |
Use credentials with upload permissions, or contact the administrator for authorization. |
|
|
The service cannot save the uploaded content. |
Keep the desensitized response information and try again; if it continues to fail, contact support personnel. |
Follow-up operations¶
Use data.file_id [create-file.md] to associate the file to the volume.