execute_config_action
POST
/api/v1/admin/config/{key}/action
const url = 'https://example.com/api/v1/admin/config/example/action';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"action":"build_wopi_discovery_preview_config","discovery_url":"example","draft_values":"example","target_email":"example","value":"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/admin/config/example/action";
let payload = json!({ "action": "build_wopi_discovery_preview_config", "discovery_url": "example", "draft_values": "example", "target_email": "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.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/admin/config/example/action \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "action": "build_wopi_discovery_preview_config", "discovery_url": "example", "draft_values": "example", "target_email": "example", "value": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”key
required
string
Config action target key
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Execute a config action (e.g., send test email).
object
action
required
string
discovery_url
string | null
draft_values
Optional transient config values for test actions such as
ConfigActionType::TestAria2Rpc.
These override persisted config for the action without writing to the DB.
Runtime action handlers validate the accepted keys for their action.
object | null
target_email
string | null
value
string | null
Responses
Section titled “Responses”Config action executed
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
Example
{ "code": "success"}Invalid request
Unauthorized
Forbidden
Config action target not found
Mail service unavailable