set_property
PUT
/api/v1/properties/{entity_type}/{entity_id}
const url = 'https://example.com/api/v1/properties/file/1';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","namespace":"example","value":"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/properties/file/1";
let payload = json!({ "name": "example", "namespace": "example", "value": "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("PUT").unwrap(), url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request PUT \ --url https://example.com/api/v1/properties/file/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "namespace": "example", "value": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”entity_type
required
实体类型(文件/文件夹)
string
Entity type: ‘file’ or ‘folder’
entity_id
required
integer format: int64
Entity ID
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Set or delete a custom property on an entity.
object
name
required
string
namespace
required
string
value
string | null
Examplegenerated
{ "name": "example", "namespace": "example", "value": "example"}Responses
Section titled “Responses”Property set
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
code
required
string
data
object
entity_id
required
integer format: int64
entity_type
required
实体类型(文件/文件夹)
string
id
required
integer format: int64
name
required
string
namespace
required
string
value
string | null
error
msg
required
string
Example
{ "code": "success", "data": { "entity_type": "file" }}Unauthorized
DAV: namespace is read-only
Entity not found