使用API密钥调用接口时请在请求头中添加 X-API-Key: your_api_key
请求地址: /api/v1/weather?city=北京
// 请求示例 (cURL)
curl -X GET "http://your-domain/api/v1/weather?city=北京" \
-H "X-API-Key: your_api_key_here"
// 响应示例
{
"error": "",
"data": {
"city": "北京",
"temperature": "25°C",
"humidity": "60%",
"weather": "晴",
"updated": "2026-05-04 10:30:00"
}
}
请求地址: /api/v1/currency?from=USD&to=CNY
// 请求示例 (cURL)
curl -X GET "http://your-domain/api/v1/currency?from=USD&to=CNY" \
-H "X-API-Key: your_api_key_here"
// 响应示例
{
"error": "",
"data": {
"from": "USD",
"to": "CNY",
"rate": "6.85",
"updated": "2026-05-04 10:30:00"
}
}