create_empty_file
const url = 'https://example.com/api/v1/files/new';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"folder_id":1,"name":"example","relative_path":"example"}'};
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/files/new";
let payload = json!({ "folder_id": 1, "name": "example", "relative_path": "example" });
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/files/new \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "folder_id": 1, "name": "example", "relative_path": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Optional opaque replay key, scoped to the authenticated actor and workspace
Request Bodyrequired
Section titled “Request Bodyrequired”Create an empty file.
object
Examplegenerated
{ "folder_id": 1, "name": "example", "relative_path": "example"}Responses
Section titled “Responses”Empty file created
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
object
High-level file category inferred from extension and MIME type.
object
object
Compatibility mode for locks covering the same resource hierarchy.
Total quota bytes for the file detail view: current size plus all
historical version sizes. size is only the current version size.
object
object
object
Connector-owned field that caused a configuration validation failure.
This is intentionally optional so existing diagnostics remain wire-compatible.
Connector field scope, for example connector_config or static_credential.
Example
{ "code": "success", "data": { "file_category": "image", "lock_state": { "state": "unlocked" } }}Invalid name
Unauthorized
Idempotency key request mismatch or retained result was purged