create_team_share
POST
/api/v1/teams/{team_id}/shares
const url = 'https://example.com/api/v1/teams/1/shares';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expires_at":"example","max_downloads":1,"password":"example","target":{"id":1,"type":"file"}}'};
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/shares";
let payload = json!({ "expires_at": "example", "max_downloads": 1, "password": "example", "target": json!({ "id": 1, "type": "file" }) });
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/shares \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expires_at": "example", "max_downloads": 1, "password": "example", "target": { "id": 1, "type": "file" } }'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 share.
object
expires_at
string | null
max_downloads
integer format: int64
password
string | null
target
required
object
id
required
integer format: int64
type
required
实体类型(文件/文件夹)
string
Responses
Section titled “Responses”Team share created
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
code
required
string
data
object
created_at
required
string
download_count
required
integer format: int64
expires_at
string | null
id
required
integer format: int64
max_downloads
required
integer format: int64
target
required
object
id
required
integer format: int64
type
required
实体类型(文件/文件夹)
string
team_id
integer | null format: int64
token
required
string
updated_at
required
string
user
One of:
null
Lightweight user identity for embedding in admin list/detail responses.
object
id
required
integer format: int64
profile
required
object
avatar
required
object
source
required
用户头像来源
string
url_1024
string | null
url_512
string | null
version
required
integer format: int32
display_name
string | null
username
required
string
view_count
required
integer format: int64
error
msg
required
string
Example
{ "code": "success", "data": { "target": { "type": "file" }, "user": { "profile": { "avatar": { "source": "none" } } } }}Unauthorized
Forbidden