Spor API
Developer Docs v1.4

Spor API Kullanımı

Sistemlerimize entegre olmak için ihtiyacınız olan tüm endpoint'ler, canlı test araçları ve harici siteler için lüks widget builder bu sayfada yer almaktadır.

Genel Bakış

Spor API, verileri hem standart HTTP istekleri (REST) hem de gerçek zamanlı olay akışları (WebSocket) üzerinden sunar. Anlık skorlar, kartlar og maç detayları gibi saniyelik güncellemeler için WebSocket entegrasyonu kullanmanız tavsiye edilir.

Base URL https://spor.grafiklab.net/api/v1

Kimlik Doğrulama (Auth)

Tüm API isteklerinde (REST ve WebSocket) güvenlik amacıyla api_key parametresi zorunludur. Panelinize giriş yaparak size özel oluşturulan anahtarı kullanabilirsiniz.

// URL Parametresi olarak gönderilir
?api_key=YOUR_API_KEY_HERE

API Playground

JSON Response
Ateşlemeye Hazır...

Canlı Skor Widget Builder

WebSocket Bağlantısı

Setup Client
import { io } from 'socket.io-client';

const socket = io('https://spor.grafiklab.net', {
  path: "/socket.io/",
  transports: ['websocket']
});
REST Endpoints
GET

Puan Durumu (HTTP)

/api/v1?action=standings&tournament_id=52&season_id=77805
GET

Haftalık Fikstür (HTTP)

/api/v1?action=matches&week=25&tournament_id=52
WebSocket Events
WS EMIT & ON

Puan Durumu (Standings)

İstek Gönder (Emit)
socket.emit('request_standings', {
  api_key: 'YOUR_KEY',
  tournament_id: 52,
  season_id: 77805
});
Yanıt Dinle (On)
socket.on('standings_update', (response) => {
  // response.data Array:
  [
    { "rank": 1, "team": "Galatasaray"... },
    { "rank": 2, "team": "Fenerbahçe"... }
  ]
});
WS EMIT & ON

Haftalık Maçlar (Weekly Matches)

İstek Gönder (Emit)
socket.emit('request_weekly_matches', {
  api_key: 'YOUR_KEY',
  tournament_id: 52,
  season_id: 77805,
  week: 25 // Opsiyonel
});
Yanıt Dinle (On)
socket.on('weekly_matches_update', (res) => {
  // res.current_week: 25
  // res.data Array:
  [
    { "id": 123, "home": "BJK", "away": "GS"... }
  ]
});
WS EMIT & ON

Canlı Skorlar (Live Matches)

Önemli: request_live_matches isteğini gönderdiğiniz an sistem sizi canlı skor odasına alır ve veriler güncellendikçe otomatik olarak live_update kanalından size gönderilir.
İstek Gönder (Emit)
socket.emit('request_live_matches', {
  api_key: 'YOUR_KEY'
});
Yanıt Dinle (On)
socket.on('live_update', (data) => {
  // Liglere göre gruplanmış canlı veriler:
  {
    "Süper Lig": [
       { "home_team": "Trabzon", "match_time": "45'"... }
    ]
  }
});
WS EMIT & ON

Maç Detayı (Match Details)

İstek Gönder (Emit)
// 1. Odaya Katıl
socket.emit('join_match_room', {
  api_key: 'YOUR_KEY',
  match_id: 123456
});

// 2. İlk Veriyi İste
socket.emit('request_match_details', {
  api_key: 'YOUR_KEY',
  match_id: 123456
});
Yanıt Dinle (On)
// İlk Yanıt (Özel ID ile gelir)
socket.on('match_details_initial_123456', (res) => {
   // İlk veri yüklendiğinde
});

// Canlı Güncellemeler
socket.on('match_details_update', (res) => {
  // res.data içeriği:
  {
    "details": { "homeTeam": "...", "matchTime": "..." },
    "incidents": [ { "type": "goal", "minute": 23... } ],
    "lineups": { ... }
  }
});