update_share
PATCH
/api/v1/shares/{id}
const url = 'https://example.com/api/v1/shares/1';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expires_at":"example","max_downloads":1,"password":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}use std::str::FromStr;use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://example.com/api/v1/shares/1";
let payload = json!({ "expires_at": "example", "max_downloads": 1, "password": "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.request(reqwest::Method::from_str("PATCH").unwrap(), url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request PATCH \ --url https://example.com/api/v1/shares/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expires_at": "example", "max_downloads": 1, "password": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
integer format: int64
Share ID
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Update an existing share.
object
expires_at
string | null
max_downloads
required
integer format: int64
password
None = keep existing password, Some("") = remove password,
non-empty = replace password.
string | null
Examplegenerated
{ "expires_at": "example", "max_downloads": 1, "password": "example"}Responses
Section titled “Responses”Share updated
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" } } } }}Invalid request
Unauthorized
Share not found