Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526_Consulta2/llms.txt

Use this file to discover all available pages before exploring further.

The Statistics API aggregates all match and player data for a season into a single response. It covers global league totals (matches played, goals, cards, clean sheets), individual player rankings (top scorers, most yellow and red cards), and team performance rankings across five categories. When no season_id is supplied, statistics are scoped to the active season automatically.

Get statistics

GET /statistics
Returns global league stats, individual player rankings, and team performance rankings for a season.

Query parameters

season_id
integer
Season to retrieve statistics for. Defaults to the currently active season when omitted.

Response

The individualRankings object contains three lists, each capped at the top 5 entries.
individualRankings
object
required

Global stats fields

global
object
required
Aggregate totals for all finalised matches in the season.

Examples

curl https://api.example.com/statistics
curl "https://api.example.com/statistics?season_id=2"

Example response

{
  "global": {
    "matchesPlayed": 24,
    "totalGoals": 183,
    "avgGoals": 7.63,
    "totalYellows": 41,
    "totalReds": 3,
    "totalCleanSheets": 5
  },
  "teamRankings": {
    "mostWins": [
      {
        "id": 1,
        "name": "FC Example",
        "logo_url": "https://res.cloudinary.com/.../logo.jpg",
        "won": 8,
        "lost": 1,
        "drawn": 0,
        "goals_for": 38,
        "goals_against": 14
      }
    ],
    "mostLosses": [],
    "mostDraws": [],
    "bestOffense": [],
    "bestDefense": []
  },
  "individualRankings": {
    "topScorers": [
      {
        "id": 7,
        "name": "Carlos López",
        "photo_url": "https://res.cloudinary.com/.../photo.jpg",
        "team_name": "FC Example",
        "value": 14
      }
    ],
    "topYellowCards": [
      {
        "id": 12,
        "name": "Pedro Martínez",
        "photo_url": null,
        "team_name": "Los Rápidos",
        "value": 4
      }
    ],
    "topRedCards": []
  }
}

Get user ranking

GET /statistics/user-ranking
Returns the top 10 users ranked by their prediction (porra) points for a season.

Query parameters

season_id
integer
Season to rank users for. Defaults to the active season.

Response

[
  { "id": 5, "username": "fan_user", "points": 27 },
  { "id": 9, "username": "another_fan", "points": 21 }
]

Get user prediction stats

GET /statistics/user-stats
Returns the authenticated user’s prediction points, global ranking position, and their last 20 match prediction records for the season.
Requires user authentication. Include a valid Authorization: Bearer <token> header.

Query parameters

season_id
integer
Season to retrieve stats for. Defaults to the active season.

Response

totalPoints
integer
Total prediction points earned in the season.
globalRank
integer
User’s rank among all users with points in the season. 0 if the user has no points.
history
object[]
Last 20 match predictions, ordered by match date descending.

Build docs developers (and LLMs) love