完整的技术接口文档和使用指南
数字生命提供完整的RESTful API接口,支持JSON格式的数据交换。 所有API都支持CORS,可以直接在前端JavaScript中调用。
基础API服务器 - 获取API信息和可用端点列表
反馈API服务器 - 用户反馈系统API
健康检查 - 检查API服务器状态
{
"status": "healthy",
"timestamp": "2026-02-10T00:07:43.524816",
"uptime": 10
}
系统信息 - 获取服务器系统信息
{
"server_info": {
"hostname": "server-hostname",
"platform": "Linux",
"python_version": "3.9.0"
},
"timestamp": "2026-02-10T00:07:43.524816"
}
访问统计 - 获取API访问统计数据
{
"total_requests": 150,
"today_requests": 25,
"popular_endpoints": {
"/api/health": 50,
"/api/system": 30,
"/api/stats": 20
}
}
资源监控 - 获取系统资源使用情况
{
"cpu": {
"percent": 15.5,
"cores": 4,
"frequency": 3200
},
"memory": {
"total": 8192,
"available": 4096,
"percent": 50.0,
"used": 4096
},
"disk": {
"total": 500000,
"used": 250000,
"free": 250000,
"percent": 50.0
}
}
健康检查 - 检查反馈API服务器状态
获取反馈列表 - 查询用户反馈
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| limit | integer | 否 | 每页数量,默认10 |
| offset | integer | 否 | 偏移量,默认0 |
| status | string | 否 | 反馈状态:new, read, resolved |
{
"feedback": [
{
"id": 1,
"name": "测试用户",
"email": "test@example.com",
"message": "这个API非常好用!",
"rating": 5,
"category": "general",
"status": "new",
"created_at": "2026-02-09 16:16:47"
}
],
"pagination": {
"total": 1,
"limit": 10,
"offset": 0,
"has_more": false
}
}
提交反馈 - 创建新的用户反馈
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| message | string | 是 | 反馈内容 |
| name | string | 否 | 用户姓名 |
| string | 否 | 用户邮箱 | |
| rating | integer | 否 | 评分 (1-5) |
| category | string | 否 | 分类:general, bug_report, feature_request |
{
"name": "测试用户",
"email": "test@example.com",
"message": "这个API非常好用!",
"rating": 5,
"category": "general"
}
{
"success": true,
"message": "Feedback submitted successfully",
"feedback_id": 1,
"timestamp": "2026-02-10T00:16:47.263587"
}
统计信息 - 获取反馈系统统计
{
"total_feedback": 3,
"status_stats": {
"new": 3
},
"rating_stats": {
"3": 1,
"4": 1,
"5": 1
},
"recent_feedback": [
{
"id": 1,
"name": "测试用户",
"message": "这个API非常好用!",
"rating": 5,
"created_at": "2026-02-09 16:16:47"
}
]
}
// 获取系统信息
fetch('http://localhost:8099/api/system')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// 提交反馈
fetch('http://localhost:8103/api/feedback', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '你的名字',
message: '你的反馈内容',
rating: 5
})
})
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch(error => console.error('Error:', error));