Statistics

Stats live in two halves: a ranking row that says who and when, and a stat row that holds the numbers for that sport. Every stats table has a getStats function that joins the two for you and hands back one flat object.

team/getStats is the shortcut for the most common case — one team, current stats. The tables below are the same thing for players, coaches, conferences, and league-wide baselines.

The tables

ClassIdentify a row withCovers
statistic_rankingteam_idOne team's stats
player_statistic_rankingplayer_id, optionally team_idOne player's stats
coach_statistic_rankingcoach_idOne coach's stats
conference_statistic_rankingconference_idOne conference's stats
league_statistic_rankingnothing extraDivision-wide team averages
conference_player_statistic_rankingconference_idPlayer averages across one conference
league_player_statistic_rankingnothing extraPlayer averages across the whole division

The last three are baselines. Use them to normalize a team or player against their conference or the division instead of computing the average yourself.

Required arguments

organization_id

That's what picks the sport, and therefore which stat columns come back — basketball and football store different numbers. Everything else is a filter: add division_id, season, and whichever id from the table above identifies the row you want.

Picking which day you get

Rankings are stored once per day, so a season has a row per day per subject.

  • current: 1 — the latest calculated row. This is almost always what you want.
  • date_of_rank — a specific day, for point-in-time history.

getStats returns the first matching row, so without current or date_of_rank you're not in control of which day you get.

Request

GET

https://api.srating.io/v1/player_statistic_ranking/getStats?organization_id=f1c37c98-3b4c-11ef-94bc-2a93761010b8&division_id=bf602dc4-3b4a-11ef-94bc-2a93761010b8&player_id=dff6dce2-ad5a-11ed-9185-b6be2f39279c&season=2024&current=1

POST

fetch('https://api.srating.io/v1', {
  'method': 'POST',
  'headers': {
    'Content-Type': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
  },
  'body': JSON.stringify({
    'class': 'player_statistic_ranking',
    'function': 'getStats',
    'arguments': {
      'organization_id': 'f1c37c98-3b4c-11ef-94bc-2a93761010b8',
      'division_id': 'bf602dc4-3b4a-11ef-94bc-2a93761010b8',
      'player_id': 'dff6dce2-ad5a-11ed-9185-b6be2f39279c',
      'season': 2024,
      'current': 1,
    }
  }),
}).then(response => {
  return response.json();
}).then(json => {
  console.log(json);
  return json;
}).catch(error => {
  console.log(error);
});

Response

A single object: the ranking row with the sport's stat columns merged in. Trimmed here for readability — the real row carries every stat for the sport, each with a matching _rank.

{
  "player_statistic_ranking_id": "8c1d2e3f-61ca-11ef-9222-9667e47de71a",
  "organization_id": "f1c37c98-3b4c-11ef-94bc-2a93761010b8",
  "division_id": "bf602dc4-3b4a-11ef-94bc-2a93761010b8",
  "season": 2024,
  "team_id": "87019264-8549-11ed-bf01-5296e1552828",
  "player_id": "dff6dce2-ad5a-11ed-9185-b6be2f39279c",
  "sport_player_statistic_id": "8c1a9b7c-61ca-11ef-9222-9667e47de71a",
  "basketball_player_statistic_id": "8c1a9b7c-61ca-11ef-9222-9667e47de71a",
  "games": 39,
  "minutes_played_per_game": 32.1,
  "points_per_game": 25.2,
  "total_rebounds_per_game": 12.2,
  "field_goal_percentage": 62.3,
  "efficiency_rating": 31.4,
  "points_per_game_rank": 2,
  "total_rebounds_per_game_rank": 4,
  "efficiency_rating_rank": 1,
  "date_of_rank": "2024-04-08T04:00:00.000Z",
  "career": 0,
  "career_active": 0,
  "current": 1,
  "deleted": 0
}

Career totals

player_statistic_ranking also stores career rows. Pass career: 1 for career totals instead of a single season, and career_active: 1 to limit that to players who are still active.

Getting everybody at once

getStats is one row at a time. For a whole division in one request — every team or every player, ranked — use ranking/download.

On this page