Spor API Entegrasyon Dokümantasyonu
Canlı maç skorları, gol/kart/oyuncu değişikliği olayları, lig puan durumları ve fikstürler için optimize edilmiş REST ve WebSocket mimarisi.
Genel Bakış
Spor API, dünya çapındaki lig ve turnuva karşılaşmalarını standartlaştırılmış bir yapıda sunar. REST API sorgu bazlı tekil veri çekimleri için; WebSocket ise gecikmesiz canlı maç ve skor takibi için optimize edilmiştir.
https://spor.grafiklab.net/api/v1wss://spor.grafiklab.net/socket.io/Kimlik Doğrulama (API Key)
Her istekte API Key parametresi zorunludur. REST isteklerinde URL parametresi, WebSocket isteklerinde ise emit edilen payload içerisine yerleştirilir.
// REST URL Örneği
https://spor.grafiklab.net/api/v1?api_key=YOUR_API_KEY_HERE&action=live_matches
// WebSocket Emit Örneği
socket.emit('request_live_matches', { api_key: 'YOUR_API_KEY_HERE' });Canlı API Test Konsolu
Canlı TestGömülebilir Canlı Skor Widget'ı
iframe GeneratorWebSocket Event Belgeleri & Canlı Çıktılar
Sunucuya emit edilen istekler ve sunucunun geri fırlattığı gerçek zamanlı payload'lar.
1. Puan Durumu (request_standings)
socket.emit('request_standings', {
api_key: 'YOUR_KEY',
tournament_id: 52,
season_id: 98080
});📌 Puan durumu verisini talep eder.
socket.on('standings_update', (res) => {
console.log(res.data);
});📌 Puan durumu güncellemelerini dinler.
{
"tournament_id": 52,
"data": [
{
"position": 1,
"team": "Galatasaray",
"teamid": 3061,
"logo": "/api/logos/3061",
"points": 78,
"played": 30,
"wins": 25,
"draws": 3,
"losses": 2,
"goal_difference": "+48",
"goals_for": 74,
"goals_against": 26,
"last_5_matches": [
{ "result": "G", "home_team_score": 3, "away_team_score": 1, "date": "02.09.2026" }
],
"next_match": {
"home_team_name": "Fenerbahçe",
"away_team_name": "Galatasaray",
"date": "15.09.2026 20:00",
"is_home": false
}
}
]
}2. Canlı Skor Havuzu (request_live_matches)
socket.emit('request_live_matches', {
api_key: 'YOUR_KEY',
date: '2026-09-08'
});📌 Canlı odaya katılır ve günün maçlarını çeker.
socket.on('live_update', (data) => {
console.log('⚡ Canlı Skor Değişti:', data);
});📌 Gol veya dakika değiştiğinde anlık delta verisini yakalar.
{
"Saudi Pro League": [
{
"id": 16629480,
"tournament_id": 955,
"season_id": 99275,
"country": "Saudi Arabia",
"start_time": "20:00",
"startTimestamp": 1788795000,
"home_team_id": 167228,
"home_team": "Al-Khaleej",
"home_team_logo": "https://spor.grafiklab.net/api/logos/167228",
"away_team_id": 168088,
"away_team": "Al-Riyadh",
"away_team_logo": "https://spor.grafiklab.net/api/logos/168088",
"home_score": 0,
"away_score": 0,
"match_time": "29'",
"status_class": "live",
"status_description": "1st half",
"red_cards": 0,
"round": 6
}
]
}3. Maç Odası & Olay Yayını (join_match_room)
socket.emit('join_match_room', {
api_key: 'YOUR_KEY',
match_id: 16629480
});📌 Maç odasına katılır. HTTP polling yapmanıza gerek kalmaz.
socket.on('match_details_16629480', (res) => {
console.log('📢 Gol/Kart/Değişiklik:', res.data);
});📌 Gol veya kart olduğunda sunucu doğrudan bu eventi fırlatır.
{
"details": {
"id": 16629480,
"startTimestamp": 1788795000,
"tournament": { "name": "Saudi Pro League", "id": 3708 },
"status": {
"code": 6,
"description": "1st half",
"type": "inprogress"
},
"homeTeam": { "id": 167228, "name": "Al-Khaleej" },
"awayTeam": { "id": 168088, "name": "Al-Riyadh" },
"homeScore": { "current": 0, "display": 0 },
"awayScore": { "current": 0, "display": 0 },
"time": {
"currentPeriodStartTimestamp": 1788795005,
"initial": 0,
"max": 2700
},
"venue": { "name": "EGO Stadium" },
"referee": { "name": "Fareeh Al Jaloud" }
},
"incidents": [
{
"id": 126752604,
"time": 14,
"incidentType": "substitution",
"incidentClass": "injury",
"injury": true,
"isHome": false,
"playerOut": { "name": "Mahmoud Trézéguet" },
"playerIn": { "name": "Hassan Hashim Al-Ali" }
}
],
"statistics": [
{
"groupName": "Match overview",
"statisticsItems": [
{ "name": "Ball possession", "home": "56%", "away": "44%" }
]
}
]
}4. Takımın Gelecek Maçları (request_team_next_matches)
socket.emit('request_team_next_matches', {
api_key: 'YOUR_KEY',
team_id: 3050,
page: 0
});📌 Takımın önündeki maçları talep eder.
socket.on('team_next_matches_update', (res) => {
console.log(res.events);
});📌 Fikstür listesini dinler.
{
"team_id": 3050,
"hasNextPage": true,
"events": [
{
"id": 16483673,
"slug": "erzurumspor-fk-besiktas-jk",
"startTimestamp": 1789146000,
"date": "12.09.2026",
"time": "20:00",
"round": 5,
"status": "notstarted",
"tournament": { "id": 62, "unique_id": 52, "name": "Trendyol Süper Lig" },
"homeTeam": { "id": 3050, "name": "Beşiktaş", "logo": "/api/logos/3050" },
"awayTeam": { "id": 55603, "name": "Erzurumspor", "logo": "/api/logos/55603" },
"is_home": true
}
]
}5. Takım Transferleri (request_transfer)
socket.emit('request_transfer', {
api_key: 'YOUR_KEY',
team_id: 3050
});socket.on('transfer_update', (res) => {
console.log(res.data);
});