create_team_webdav_account
POST
/api/v1/teams/{team_id}/webdav-accounts
const url = 'https://example.com/api/v1/teams/1/webdav-accounts';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"password":"example","root_folder_id":1,"username":"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/teams/1/webdav-accounts";
let payload = json!({ "password": "example", "root_folder_id": 1, "username": "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/teams/1/webdav-accounts \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "password": "example", "root_folder_id": 1, "username": "example" }'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
Create a new WebDAV sub-account.
object
password
string | null
root_folder_id
integer | null format: int64
username
required
string
Examplegenerated
{ "password": "example", "root_folder_id": 1, "username": "example"}Responses
Section titled “Responses”Team WebDAV account created
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
code
required
string
data
创建账号后返回的响应(包含一次性明文密码)
object
id
required
integer format: int64
password
required
明文密码,只返回一次
string
root_folder_path
string | null
team_id
integer | null format: int64
username
required
string
error
msg
required
string
Example
{ "code": "success"}Unauthorized