API文档中心
欢迎使用亚星体育API文档。本页面提供快速上手指南、接口说明以及多语言调用示例,帮助开发者高效集成体育数据服务。
快速上手指南
- 注册账号并获取 API Key。
- 选择需要的赛事数据接口(足球、篮球、网球等)。
- 使用下方示例代码调用 API。
接口说明
示例接口:https://api.yaxin222-cn.com/v1/matches
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| sport | string | 是 | 体育类型,例如 football、basketball |
| date | string | 否 | 日期,格式 YYYY-MM-DD,默认当天 |
| limit | integer | 否 | 返回条数,默认 10,最大 100 |
| lang | string | 否 | 返回语言,支持 zh、en |
| timezone | string | 否 | 时区设置,默认 UTC |
返回示例
{
"status": "success",
"data": [
{
"match_id": 12345,
"sport": "football",
"teams": ["Team A", "Team B"],
"score": "2-1",
"time": "78'",
"date": "2026-07-10",
"stadium": "National Stadium"
}
]
}
错误码
| 错误码 | 说明 | 解决方案 |
|---|---|---|
| 401 | 未授权 | 检查 API Key 是否正确或是否过期 |
| 403 | 权限不足 | 当前套餐不支持该接口,请升级套餐 |
| 429 | 调用频率过高 | 降低调用频率或升级套餐以提升限额 |
| 500 | 服务器错误 | 稍后重试,如持续出现请提交工单 |
调用限制
- 免费版:每分钟最多 60 次调用
- 专业版:每分钟最多 600 次调用
- 企业版:支持高并发调用,具体限额可定制
调用示例
JavaScript (Fetch)
fetch("https://api.yaxing.com/v1/matches?sport=football&date=2026-07-10", {
headers: { "Authorization": "Bearer YOUR_API_KEY" }
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
Python (Requests)
import requests
url = "https://api.yaxing.com/v1/matches"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"sport": "football", "date": "2026-07-10"}
response = requests.get(url, headers=headers, params=params)
print(response.json())
Java (HttpURLConnection)
import java.net.*;
import java.io.*;
public class ApiExample {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api.yaxing.com/v1/matches?sport=football&date=2026-07-10");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
}
}
技术支持
如遇问题,请参考FAQ与工单系统、或加入开发者社区。