test_policy_params
POST
/api/v1/admin/policies/test
const url = 'https://example.com/api/v1/admin/policies/test';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"access_key":"example","base_path":"example","bucket":"example","driver_type":"local","endpoint":"example","options":{"content_dedup":true,"media_metadata_extensions":["example"],"object_storage_download_strategy":"relay_stream","object_storage_upload_strategy":"relay_stream","onedrive_account_mode":"personal","onedrive_cloud":"global","onedrive_drive_id":"example","onedrive_group_id":"example","onedrive_root_item_id":"example","onedrive_site_id":"example","onedrive_tenant":"example","provider_download_filename_mode":"provider_native","provider_download_strategy":"server_relay","provider_resumable_upload_strategy":"server_relay","remote_download_strategy":"relay_stream","remote_upload_strategy":"relay_stream","s3_connect_timeout_secs":1,"s3_operation_timeout_secs":1,"s3_path_style":true,"s3_read_timeout_secs":1,"sftp_host_key_fingerprint":"example","storage_native_media_metadata_enabled":true,"storage_native_processing_enabled":true,"thumbnail_extensions":["example"],"thumbnail_processor":"images"},"policy_id":1,"remote_node_id":1,"remote_storage_target_key":"example","secret_key":"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/policies/test";
let payload = json!({ "access_key": "example", "base_path": "example", "bucket": "example", "driver_type": "local", "endpoint": "example", "options": json!({ "content_dedup": true, "media_metadata_extensions": ("example"), "object_storage_download_strategy": "relay_stream", "object_storage_upload_strategy": "relay_stream", "onedrive_account_mode": "personal", "onedrive_cloud": "global", "onedrive_drive_id": "example", "onedrive_group_id": "example", "onedrive_root_item_id": "example", "onedrive_site_id": "example", "onedrive_tenant": "example", "provider_download_filename_mode": "provider_native", "provider_download_strategy": "server_relay", "provider_resumable_upload_strategy": "server_relay", "remote_download_strategy": "relay_stream", "remote_upload_strategy": "relay_stream", "s3_connect_timeout_secs": 1, "s3_operation_timeout_secs": 1, "s3_path_style": true, "s3_read_timeout_secs": 1, "sftp_host_key_fingerprint": "example", "storage_native_media_metadata_enabled": true, "storage_native_processing_enabled": true, "thumbnail_extensions": ("example"), "thumbnail_processor": "images" }), "policy_id": 1, "remote_node_id": 1, "remote_storage_target_key": "example", "secret_key": "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/policies/test \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "access_key": "example", "base_path": "example", "bucket": "example", "driver_type": "local", "endpoint": "example", "options": { "content_dedup": true, "media_metadata_extensions": [ "example" ], "object_storage_download_strategy": "relay_stream", "object_storage_upload_strategy": "relay_stream", "onedrive_account_mode": "personal", "onedrive_cloud": "global", "onedrive_drive_id": "example", "onedrive_group_id": "example", "onedrive_root_item_id": "example", "onedrive_site_id": "example", "onedrive_tenant": "example", "provider_download_filename_mode": "provider_native", "provider_download_strategy": "server_relay", "provider_resumable_upload_strategy": "server_relay", "remote_download_strategy": "relay_stream", "remote_upload_strategy": "relay_stream", "s3_connect_timeout_secs": 1, "s3_operation_timeout_secs": 1, "s3_path_style": true, "s3_read_timeout_secs": 1, "sftp_host_key_fingerprint": "example", "storage_native_media_metadata_enabled": true, "storage_native_processing_enabled": true, "thumbnail_extensions": [ "example" ], "thumbnail_processor": "images" }, "policy_id": 1, "remote_node_id": 1, "remote_storage_target_key": "example", "secret_key": "example" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Test a storage policy connection by parameters (without saving).
object
access_key
string | null
base_path
string | null
bucket
string | null
driver_type
required
存储驱动类型
string
endpoint
string | null
options
One of:
null
object
content_dedup
boolean | null
media_metadata_extensions
Array<string>
object_storage_download_strategy
onedrive_account_mode
onedrive_cloud
onedrive_drive_id
string | null
onedrive_group_id
string | null
onedrive_root_item_id
string | null
onedrive_site_id
string | null
onedrive_tenant
string | null
provider_download_filename_mode
provider_resumable_upload_strategy
s3_connect_timeout_secs
integer | null format: int64
s3_operation_timeout_secs
integer | null format: int64
s3_path_style
boolean | null
s3_read_timeout_secs
integer | null format: int64
sftp_host_key_fingerprint
string | null
storage_native_media_metadata_enabled
boolean | null
storage_native_processing_enabled
boolean | null
thumbnail_extensions
Array<string>
policy_id
integer | null format: int64
remote_node_id
integer | null format: int64
remote_storage_target_key
string | null
secret_key
string | null
Responses
Section titled “Responses”Connection successful
Media typeapplication/json
统一 API 响应格式
成功: { "code": "success", "msg": "", "data": {...} }
失败: { "code": "auth.credentials_failed", "msg": "Invalid Credentials" }
object
Example
{ "code": "success"}Connection request rejected
Unauthorized