# 获取服务器列表
curl -X GET "http://localhost:2017/api/servers" \
-H "Authorization: Bearer YOUR_TOKEN"
# 添加服务器
curl -X POST "http://localhost:2017/api/servers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"name": "My Server",
"protocol": "vmess",
"address": "example.com",
"port": 443
}'
import requests
# 获取服务器列表
response = requests.get(
"http://localhost:2017/api/servers",
headers={"Authorization": "Bearer YOUR_TOKEN"}
)
servers = response.json()
# 添加服务器
new_server = {
"name": "My Server",
"protocol": "vmess",
"address": "example.com",
"port": 443
}
response = requests.post(
"http://localhost:2017/api/servers",
json=new_server,
headers={"Authorization": "Bearer YOUR_TOKEN"}
)
// 获取服务器列表
fetch('http://localhost:2017/api/servers', {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(servers => console.log(servers));
// 添加服务器
fetch('http://localhost:2017/api/servers', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({
name: 'My Server',
protocol: 'vmess',
address: 'example.com',
port: 443
})
});