create_remote_node_storage_target
POST
/api/v1/admin/remote-nodes/{id}/storage-targets
const url = 'https://example.com/api/v1/admin/remote-nodes/1/storage-targets';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_path":"example","is_default":true,"name":"example","driver_type":"local"}'};
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/remote-nodes/1/storage-targets";
let payload = json!({ "base_path": "example", "is_default": true, "name": "example", "driver_type": "local" });
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/remote-nodes/1/storage-targets \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_path": "example", "is_default": true, "name": "example", "driver_type": "local" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
integer format: int64
Remote node ID
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Responses
Section titled “Responses”Remote node storage target created
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
code
required
string
data
object
applied_revision
required
integer format: int64
base_path
required
string
bucket
required
string
created_at
required
string
desired_revision
required
integer format: int64
driver_type
required
存储驱动类型
string
endpoint
required
string
is_default
required
boolean
last_error
required
string
name
required
string
target_key
required
string
updated_at
required
string
error
msg
required
string
Example
{ "code": "success", "data": { "driver_type": "local" }}Unauthorized
Forbidden
Remote node not found
Remote storage targets require a single primary binding