Build the NBA standings
season_team_stats has one row per team per season — wins, losses, games played. Resolve the current season, page the whole table, and sort by wins to build the standings.
1. Resolve the current season
curl -sS --compressed \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/seasons?limit=200'2. Page every team's season record
season_team_stats is keyed by season_id — one row per team; the auto-pager collects them all.
curl -sS --compressed \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/season_team_stats?season_id=2025'3. Order by wins, best first
Sort the accumulated rows by wins descending.
const standings = [...rows].sort((a, b) => b.wins - a.wins)4. Take the top ten
const top = standings.slice(0, 10)5. Print the standings
console.log("NBA standings — top 10 by wins") console.log(["team_id", "wins", "losses"].join('\t')) for (const row of top) { console.log([String(row.team_id ?? ''), String(row.wins ?? ''), String(row.losses ?? '')].join('\t')) }