Skip to main content

系统配置 API

系统配置相关的 API 接口。

获取系统配置

请求

GET /v1/settings
Authorization: Bearer {your_access_token}

请求示例

curl -X GET https://api.example.com/v1/settings \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

响应示例

{
"code": 200,
"message": "success",
"data": {
"site_name": "我的网站",
"site_description": "网站描述",
"maintenance_mode": false,
"allow_registration": true,
"max_upload_size": 10485760
},
"timestamp": 1640995200000
}

更新系统配置

请求

PUT /v1/settings
Authorization: Bearer {your_access_token}
Content-Type: application/json

请求参数

参数类型必填描述
site_namestring网站名称
site_descriptionstring网站描述
maintenance_modeboolean维护模式
allow_registrationboolean允许注册

请求示例

curl -X PUT https://api.example.com/v1/settings \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"site_name": "新网站名称",
"maintenance_mode": false
}'
权限要求

此接口需要管理员权限。