To‘liq hujjat: GraphQL (Hudl/StatsBomb shape) + REST.
Graphics: faqat api_url, client_id, client_secret.
Ma’lumot: live eventlar (~3s) → memory → API (request pathda SB dump yo‘q).
'api_url' => "https://dostats.uzsl.uz/apiv1/v1/", 'client_id' => "<from admin>", 'client_secret' => "<from admin>",
Aliaslar: POST /v1/token = POST /token; POST /v1/graphql = POST /graphql (apiv1 prefix bilan).
StatsBomb events (~3s tick)
→ MatchTracker memory
├─ team stats → GraphQL live_team_match_aggregated_stat · REST /broadcast · /stats
├─ player panel → REST /admin/explore/.../players/{id}
└─ async SQLite (events, match_stats, player_match_stats)
live_player_match_aggregated_stat to‘liq dump SB da timeout — lokalda eventlardan hisob| Usul | Qayerda | Qanday |
|---|---|---|
| Graphics Bearer | POST /v1/token → GraphQL |
Authorization: Bearer <access_token> |
| API key | REST / broadcast / explore API | X-API-Key yoki Authorization: Bearer |
| SSE | /broadcast/.../stream |
?api_key= |
| Admin | /admin/* |
POST /admin/login yoki HTTP Basic |
curl -X POST https://dostats.uzsl.uz/apiv1/v1/token \
-H 'content-type: application/json' \
-d '{"client_id":"YOUR_ID","client_secret":"YOUR_SECRET"}'
# → { "access_token":"uzsl_…", "token_type":"Bearer", "expires_in":86400 }
Default GRAPHQL_MODE=local. Upstream majburiy: header X-GraphQL-Upstream: 1.
| Root | Manba | Majburiy filter |
|---|---|---|
live_competition_season | config | — |
live_match | SQLite catalog | odatda competition/season |
live_match_event | SQLite events | where.match_id._eq |
live_match_event_aggregate | SQLite | where |
live_team_match_aggregated_stat | memory → SQLite | where.match_id._eq |
Boshqa rootlar (lineup, player agg, …): upstream header yoki REST Explorer.
query {
live_competition_season {
competition_id
competition_name
season_id
season_name
}
}
query Matches {
live_match(
where: { competition_id: { _eq: 1839 }, season_id: { _eq: 316 } }
order_by: { match_date: desc }
limit: 20
) {
match_id match_name match_date match_local_kick_off
match_home_team_id match_home_team_name
match_away_team_id match_away_team_name
match_home_score match_away_score match_play_status
competition_id season_id
}
}
query MatchEvents($match_id: Int!) {
live_match_event(
where: { match_id: { _eq: $match_id } }
order_by: { index: asc }
limit: 1000
) {
id match_id name type outcome
team_id player_id
period minute second timestamp index
xg key_pass card advantage
updated_at
}
}
query EventCount($match_id: Int!) {
live_match_event_aggregate(where: { match_id: { _eq: $match_id } }) {
aggregate { count }
}
}
query TeamAgg($mid: Int!) {
live_team_match_aggregated_stat(where: { match_id: { _eq: $mid } }) {
match_id team_id stat_name value
}
}
Filter: stat_name: { _eq: "xg" } yoki team_id: { _eq: … }.
| stat_name | value | Izoh |
|---|---|---|
xg | float | Expected goals |
shots / shots-on-target / shots-off-target / shots-blocked | int | |
passes-attempted / passes-completed | int | |
pass-success-ratio | 0–1 | Hudl ratio (masalan 0.83 = 83%) |
possession | 0–1 | ratio |
key-passes / tackles-attempted / touches | int | |
goalkeeper-saves / corners-attempted | int | |
fouls-committed / offsides | int | |
yellow-cards / red-cards | int |
curl -X POST https://dostats.uzsl.uz/apiv1/v1/graphql \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'content-type: application/json' \
-d '{"query":"query { live_competition_season { competition_id season_id } }"}'
{
"operationName": "Matches",
"variables": {},
"query": "query Matches { live_match(limit: 5) { match_id match_name } }"
}
Swagger: /docs · JSON katalog: /endpoints · Auth: X-API-Key
| Method | Path | Auth | Izoh |
|---|---|---|---|
| GET | / | — | Monitor UI |
| GET | /health | — | Health |
| GET | /endpoints | — | Bu katalog (JSON) |
| GET | /v1/ | — | Shu docs |
| GET | /docs · /redoc · /openapi.json | — | OpenAPI |
| GET | /debug/requests | API key | So‘rov log |
| Method | Path | Auth | Izoh |
|---|---|---|---|
| POST | /v1/token · /token | — | client_id/secret → Bearer 24h |
| POST | /v1/graphql · /graphql | Bearer / key | Lokal GraphQL |
| GET | /broadcast/{match_id}/stats | key | Team stats memory (~ms) |
| GET | /broadcast/{match_id}/stream | key / ?api_key | SSE |
| Method | Path | Izoh |
|---|---|---|
| GET | /competitions | Competition/seasons |
| GET | /matches?date=YYYY-MM-DD | Lokal matchlar |
| GET | /matches/{id} | Metadata + score |
| GET | /matches/{id}/stats | Team stats (memory→sqlite→sync) |
| GET | /matches/{id}/events?limit=&offset= | Events page |
| POST | /matches/{id}/sync | SB pull + recompute |
| POST | /matches/{id}/track | Live poller start |
| DELETE | /matches/{id}/track | Stop |
| GET | /live | Tracked matches + tick status |
curl -H "X-API-Key: KEY" \ http://uzstats.uzsl.uz/apiv1/matches/1453630/stats
curl -H "X-API-Key: KEY" \ http://uzstats.uzsl.uz/apiv1/broadcast/1453630/stats
| Method | Path | Izoh |
|---|---|---|
| GET | /admin | Admin UI |
| POST | /admin/login | {username,password} → access_token |
| GET/POST | /admin/api-keys | CRUD + peer sync |
| GET/POST | /admin/api-keys/export|import|sync | Cluster |
| DELETE | /admin/api-keys/{id} | Revoke |
| GET/POST/DELETE | /admin/oauth-clients | Graphics clients |
| GET/POST | /admin/oauth-clients/export|import | |
| GET | /admin/usage · POST .../reset | Traffic |
| GET | /admin/system · /admin/system/local | UZ+DO load |
| GET | /admin/catalog · POST .../sync | Season fixtures |
UI: /admin/explore · Auth: admin token / API key
| Method | Path | Izoh |
|---|---|---|
| GET | /admin/explore/tournament | Turnir meta |
| GET | /admin/explore/matches | ?q & date_gte/lte & limit |
| GET | /admin/explore/matches/{id} | Detail + team stats + score |
| GET | /admin/explore/matches/{id}/events | Timeline |
| GET | /admin/explore/matches/{id}/lineups | Lineups + jabha + key stats |
| GET | /admin/explore/matches/{id}/players/{pid} | Hudl player panel (live memory) |
| GET | /admin/explore/matches/{id}/pitch | Zones 3×3 + shot/pass |
| POST | /admin/explore/matches/{id}/refresh | Hydrate parts |
Goals, Total xG, Average xG per shot, Shots, Shots On Target, Assists, Key Passes,
Possession, Passes, Successful Dribbles, Pass Completion %, Fouls Committed,
Yellow / Second Yellow / Red Cards, Offsides, Corners.
Javobda panel[] + source (memory|sqlite|events) + tracking.
client_id / client_secretapi_url = UZ yoki DO …/apiv1/v1/token + graphql o‘zgarmasinlive_team_match_aggregated_stat yoki /broadcast/{id}/stats
README (server): repo README.md ·
StatsBomb guide:
live-data-api-guide.statsbomb.com