Upload to a personal private Catalog volume¶
Upload a file and automatically associate it with the current user’s private volume, returning the file ID and volume location.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{id}/catalog-files/uploads
Before you call this API¶
Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5. For private deployments, use the corresponding product API URL.
Prepare a personal access token for the target Workspace. WORKSPACE_ID must match the path Workspace; FILE_ID comes from an actual file result. BASE_URL includes the same environment’s product prefix. Example files/IDs are placeholders.
Request parameters¶
curl --fail-with-body -sS -X POST "$BASE_URL/workspaces/$WORKSPACE_ID/catalog-files/uploads" \
-H "X-API-Key: $MOI_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-F "file=@$UPLOAD_FILE;type=text/plain"
Field |
Type |
Required |
Description |
|---|---|---|---|
|
file |
Yes |
Multipart file. |
Success returns HTTP201 with a volume association already created; do not call file-association creation again. File records, storage, and publication associations can fail at separate stages.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"file_id": "file-example",
"original_name": "sample.txt",
"size": 7,
"md5": "5177a58dc65c8a14dc90c69db3bf3dd2",
"catalog_file": {
"workspace_id": "workspace-example",
"volume_id": 30,
"file_id": "file-example",
"path": "sample.txt",
"name": "sample.txt",
"size": 7,
"md5": "5177a58dc65c8a14dc90c69db3bf3dd2"
}
}
}
Success uses string code=OK and msg=OK. data includes file_id, original_name, size, md5, and catalog_file. catalog_file contains workspace_id, volume_id, file_id, path, name, size, and md5. See Upload location.
Error responses¶
{
"code": "ErrParamInvalid",
"msg": "示例本地化错误"
}
Errors use string code/msg. Handle parameter, permission, storage, and dependency failures according to the actual response.