您需要一个API来快速获取比赛详情——名称、ID和元数据,如排名可用性——以便您可以将其集成到您的比赛页面、联赛选择器或本周的摄取管道中。在本文结束时,您将能够按国家和运动查询足球比赛,解析所需的响应,并可选择从同一来源丰富UI的球员详情。
此API的功能及使用时机
365Scores API在Zyla API Hub上公开结构化的体育数据。对于比赛,它返回给定运动和国家的比赛列表,以及有用的元数据,例如它们是否有排名、统计数据、实时排名和当前赛季编号。典型的用例:
- 填充一个国家的比赛目录(例如,显示所有葡萄牙足球联赛)。
- 根据运动和国家驱动联赛选择的下拉菜单。
- 存储联赛标识符以便稍后请求相关数据(例如,在您自己的系统中获取排名或统计数据)。
- 用交叉链接丰富球队或球员页面,链接到他们参与的比赛。
您还可以从同一API中提取以球员为中心的数据(突出统计、比赛和完整的个人资料),以展示比赛的上下文。
在Zyla API Hub上开始
打开Zyla API Hub上的365Scores API列表并订阅。该Hub采用订阅+配额模型(不是按调用付费)。对于新用户,第一个API通常提供7天的试用或50个请求;请检查列表以了解当前的活动情况。订阅后,您将收到一个API密钥。所有请求使用头部Authorization: Bearer YOUR_API_KEY。
端点:获取比赛
此端点返回给定运动和国家的比赛,以及支持运动和国家的数组。这是在Zyla API Hub上的只读GET请求。通过Authorization: Bearer YOUR_API_KEY包含您的API密钥。
HTTP方法和URL
GET https://zylalabs.com/api/13503/365scores-api/29728/get-competitions
所需查询参数
- sportId:数字运动标识符(下面的示例使用足球:1)
- countryId:数字国家标识符
- langId:语言ID
- timezone:Olson时区(例如,Europe/Berlin)。URL编码斜杠。
官方cURL示例
curl -s -X GET "https://zylalabs.com/api/13503/365scores-api/29728/get-competitions?sportId=1&countryId=11&langId=1&timezone=Europe%2FBerlin" \
-H "Authorization: Bearer YOUR_API_KEY"
官方JSON响应
{
"sports": [
{
"id": 1,
"name": "Football",
"nameForURL": "football",
"drawSupport": true,
"imageVersion": 1
}
],
"countries": [
{
"id": 11,
"name": "Portugal",
"nameForURL": "portugal",
"sportTypes": [
2,
8,
1
],
"imageVersion": 1,
"isInternational": false
}
],
"competitions": [
{
"id": 73,
"countryId": 11,
"sportId": 1,
"name": "Liga Portugal",
"longName": "Portuguese Primeira Liga",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal",
"popularityRank": 10055229,
"tableName": "Standings",
"currentSeasonNum": 94,
"currentStageNum": 1,
"color": "#000925",
"competitorsType": 1,
"imageVersion": 7,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 74,
"countryId": 11,
"sportId": 1,
"name": "Liga Portugal 2",
"shortName": "Liga Pro",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal-2",
"popularityRank": 650667,
"tableName": "Standings",
"currentSeasonNum": 38,
"currentStageNum": 1,
"color": "#186839",
"competitorsType": 1,
"imageVersion": 5,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 75,
"countryId": 11,
"sportId"…
您实际使用的内容:
- competitions[].id:比赛的稳定标识符(存储此项)。
- competitions[].name / longName / nameForURL:显示标签和SEO友好的slug。
- competitions[].hasStandings / hasStats / hasTransfers / hasLiveStandings:切换UI模块。
- competitions[].currentSeasonNum和currentStageNum:您赛季状态显示的上下文。
- sports[]和countries[]:用于您当前查询的解析运动和国家。
时区:传递有效的时区(例如,Europe/Berlin)以确保日期和时间字段——当在其他端点中存在时——按预期本地化。在此端点中,即使上述比赛记录不包含格式化日期,时区仍然是必需的。
Python示例:按国家和运动获取比赛
下面的代码片段调用相同的端点并打印比赛ID、名称和您可能在UI切换中看到的几个标志。它使用官方cURL中显示的确切查询字符串,因此您可以复制粘贴并稍后更换您的值。
import requests
API_KEY = "YOUR_API_KEY"
url = "https://zylalabs.com/api/13503/365scores-api/29728/get-competitions"
params = {
"sportId": "1",
"countryId": "11",
"langId": "1",
"timezone": "Europe/Berlin"
}
headers = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(url, params=params, headers=headers, timeout=20)
resp.raise_for_status()
data = resp.json()
# 基本验证
competitions = data.get("competitions", [])
for comp in competitions:
cid = comp.get("id")
name = comp.get("name")
has_standings = comp.get("hasStandings")
has_stats = comp.get("hasStats")
print(f"{cid}: {name} | standings={has_standings} stats={has_stats}")
节省时间的注意事项:
- 需要Authorization头:Authorization: Bearer YOUR_API_KEY。
- 在您的应用中缓存稳定列表(比赛)至少几分钟,以减少延迟。
- 如果您手动组装URL,请始终URL编码时区斜杠。
您可以与比赛配对的其他端点
除了比赛,365Scores API还允许您获取以球员为中心的数据。当您想将比赛链接到球员个人资料或最近的表现时,这些端点会很有帮助。使用相同的Authorization头,并提供所需的查询参数,完全按照所示。
获取球员详情
返回特定球员的完整详情(个人简介、职业生涯、奖杯、转会)。
方法:GET
URL:https://zylalabs.com/api/13503/365scores-api/29748/get-player-details
所需参数:
- playerId:153026
- langId:1
- timezone:Europe/Berlin
响应包括一个顶级运动员数组,其中包含个人资料详情,如年龄、国籍名称、位置、阵型位置、简短个人简介和突出统计。
获取球员比赛
返回特定球员的最近和即将进行的比赛。
方法:GET
URL:https://zylalabs.com/api/13503/365scores-api/29749/get-player-matches
所需参数:
- playerId:153026
- langId:1
- timezone:Europe/Berlin
响应包括运动员以及支持运动和国家的数组。使用此信息显示球员的当前俱乐部和即将进行的比赛,以及比赛的上下文。
获取球员统计
返回特定球员的突出和职业统计。
方法:GET
URL:https://zylalabs.com/api/13503/365scores-api/29750/get-player-stats
所需参数:
- playerId:153026
- langId:1
- timezone:Europe/Berlin
响应包含运动员及其突出统计,这些统计将统计数据与比赛关联(例如,competitionId和名称,如“巴西杯”)。这对于交叉引用您之前收到的比赛ID非常有用。
整合在一起:实用集成模式
- 国家联赛目录:调用获取比赛以获取目标国家和运动的联赛列表。存储competitions[].id以供后续使用。
- 比赛感知的球员页面:当用户导航到球员页面时,获取获取球员统计并按比赛名称显示统计。使用competitionId链接回您的联赛目录。
- 快速过滤器:通过hasStandings或hasStats等标志在客户端过滤比赛,以便仅在相关时显示正确的UI模块。
- SEO URL:使用competitions中的nameForURL构建一致的URL路径(保持您自己的路由规则;不要假设slug在所有国家中都是唯一的)。
通过MCP从AI代理调用
Zyla API Hub上的每个API都可以通过MCP端点调用,该端点与MCP兼容的开发工具(例如Claude Code、Cursor、Windsurf)一起使用。将您的客户端指向MCP端点,并将您的密钥作为查询参数传递:
https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
从那里,您可以协调工具调用,这些调用会命中您在上面看到的相同Hub端点。有关设置细节和特定于客户端的配置,请参见MCP。
操作提示
- 身份验证:所有请求都需要Authorization: Bearer YOUR_API_KEY。
- 试用和配额:Zyla使用订阅+配额。第一个API通常提供7天的试用或50个请求;请检查项目页面以确认当前活动情况。
- 本地化:在请求中一致地传递langId和timezone,以便列表标签和任何时间敏感字段在您的UI中对齐。
- 缓存:比赛不经常更改;缓存结果以减少请求量并改善用户体验。
常见问题
列出比赛需要哪些参数?
提供sportId、countryId、langId和timezone在GET https://zylalabs.com/api/13503/365scores-api/29728/get-competitions上。
我如何进行身份验证?
在请求头中发送Authorization: Bearer YOUR_API_KEY。
我可以获取当前赛季和是否存在排名吗?
可以。比赛数组包括currentSeasonNum和hasStandings等字段,以指导您的UI。
我如何将球员统计与特定比赛关联?
使用获取球员统计。它返回包含competitionId和名称的highlightStats对象,您可以将其与获取比赛的ID进行匹配。
是否有免费计划?
没有免费计划。市场使用订阅+配额模型。请检查365Scores API页面以获取当前访问选项;第一个API通常提供7天的试用或50个请求。
准备好发布您的集成了吗?订阅并在列表中获取您的密钥:开始365Scores API的7天试用。使用一个帐户、一个密钥和一致的MCP访问,构建Zyla API Hub超过10,000个公共API的目录。
官方API响应
{
"sports": [
{
"id": 1,
"name": "足球",
"nameForURL": "football",
"drawSupport": true,
"imageVersion": 1
}
],
"countries": [
{
"id": 11,
"name": "葡萄牙",
"nameForURL": "portugal",
"sportTypes": [
2,
8,
1
],
"imageVersion": 1,
"isInternational": false
}
],
"competitions": [
{
"id": 73,
"countryId": 11,
"sportId": 1,
"name": "葡萄牙联赛",
"longName": "葡萄牙超级联赛",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal",
"popularityRank": 10055229,
"tableName": "排名",
"currentSeasonNum": 94,
"currentStageNum": 1,
"color": "#000925",
"competitorsType": 1,
"imageVersion": 7,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 74,
"countryId": 11,
"sportId": 1,
"name": "葡萄牙联赛2",
"shortName": "Liga Pro",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal-2",
"popularityRank": 650667,
"tableName": "排名",
"currentSeasonNum": 38,
"currentStageNum": 1,
"color": "#186839",
"competitorsType": 1,
"imageVersion": 5,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 75,
"countryId": 11,
"sportId"…
官方API响应
{
"sports": [
{
"id": 1,
"name": "足球",
"nameForURL": "football",
"drawSupport": true,
"imageVersion": 1
}
],
"countries": [
{
"id": 11,
"name": "葡萄牙",
"nameForURL": "portugal",
"sportTypes": [
2,
8,
1
],
"imageVersion": 1,
"isInternational": false
}
],
"competitions": [
{
"id": 73,
"countryId": 11,
"sportId": 1,
"name": "葡萄牙联赛",
"longName": "葡萄牙超级联赛",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal",
"popularityRank": 10055229,
"tableName": "排名",
"currentSeasonNum": 94,
"currentStageNum": 1,
"color": "#000925",
"competitorsType": 1,
"imageVersion": 7,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 74,
"countryId": 11,
"sportId": 1,
"name": "葡萄牙联赛2",
"shortName": "Liga Pro",
"hasStandings": true,
"hasBrackets": false,
"hasStats": true,
"hasTransfers": true,
"hasLiveStandings": false,
"hasStandingsGroups": false,
"hasBets": false,
"totalGames": 0,
"liveGames": 0,
"nameForURL": "liga-portugal-2",
"popularityRank": 650667,
"tableName": "排名",
"currentSeasonNum": 38,
"currentStageNum": 1,
"color": "#186839",
"competitorsType": 1,
"imageVersion": 5,
"hideOnCatalog": false,
"hideOnSearch": false,
"hasCurrentStageStandings": true,
"hasHistory": true,
"isActive": true
},
{
"id": 75,
"countryId": 11,
"sportId"…