init_team_chunked_upload
POST
/api/v1/teams/{team_id}/files/upload/init
const url = 'https://example.com/api/v1/teams/1/files/upload/init';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"filename":"example","folder_id":1,"frontend_client_id":"example","relative_path":"example","total_size":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://example.com/api/v1/teams/1/files/upload/init";
let payload = json!({ "filename": "example", "folder_id": 1, "frontend_client_id": "example", "relative_path": "example", "total_size": 1 });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Authorization", "Bearer <token>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request POST \ --url https://example.com/api/v1/teams/1/files/upload/init \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "filename": "example", "folder_id": 1, "frontend_client_id": "example", "relative_path": "example", "total_size": 1 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”team_id
required
integer format: int64
Team ID
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Initialize a chunked upload session.
object
filename
required
string
folder_id
integer | null format: int64
frontend_client_id
string | null
relative_path
string | null
total_size
required
integer format: int64
Examplegenerated
{ "filename": "example", "folder_id": 1, "frontend_client_id": "example", "relative_path": "example", "total_size": 1}Responses
Section titled “Responses”Team upload session created
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
code
required
string
data
object
chunk_size
integer | null format: int64
mode
required
上传模式(不存 DB,仅 API 响应用)
string
presigned_headers
存储驱动可能要求的 Presigned PUT 请求头。
object
key
additional properties
string
presigned_require_etag
浏览器直传完成后是否必须从响应读取 ETag。
boolean | null
presigned_url
Presigned PUT URL(仅 presigned 模式)
string | null
provider_resumable
total_chunks
integer | null format: int32
upload_id
string | null
error
msg
required
string
Example
{ "code": "success", "data": { "mode": "direct" }}Unauthorized
Forbidden