POST /api/v1/internal/health-reports
POST
/api/v1/internal/health-reports节点 Agent 上报互探结果(批量投票)
请求体
请求数据
Content-Type · application/json
{
"type": "object",
"required": [
"voter_id"
],
"properties": {
"voter_id": {
"type": "string",
"format": "uuid"
},
"source": {
"type": "string",
"description": "缺省为 self_probe_agent"
},
"reports": {
"type": "array",
"items": {
"type": "object",
"properties": {
"target_id": {
"type": "string",
"format": "uuid"
},
"reachable": {
"type": "boolean"
},
"latency_ms": {
"type": "integer",
"nullable": true
},
"checked_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}请求示例
cURL
curl -X POST 'http://localhost:8080/api/v1/internal/health-reports' \
-H 'Accept: application/json' \
-H 'X-Agent-Secret: <AGENT_SECRET>'JavaScript
const res = await fetch('http://localhost:8080/api/v1/internal/health-reports', {
method: 'POST',
headers: {
'Accept': 'application/json',
'X-Agent-Secret': '<AGENT_SECRET>'
},
});
const data = await res.json();Python
import requests
res = requests.post(
'http://localhost:8080/api/v1/internal/health-reports',
headers={'Accept': 'application/json', 'X-Agent-Secret': '<AGENT_SECRET>'}
)
print(res.json())响应
200已接收
application/json
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"accepted": {
"type": "integer",
"description": "有效投票数"
}
}
}400请求体非法或 voter_id 非 UUID
401X-Agent-Secret 缺失或不匹配
503NODE_AGENT_SECRET 未配置,端点未启用
在线调试
在线调试
凭证仅保存在当前页面内存中自定义请求 Header
