Rank NBA season leaders
season_player_stats holds one row per player per season. Resolve the current season, page through all of it with the auto-pager, then sort client-side to build any leaderboard.
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 through the whole season
The auto-paging iterator follows the keyset cursor across every page, so you accumulate the full season of rows without a manual loop.
curl -sS --compressed \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/season_player_stats?season_id=2027'3. Rank by points
Sort the accumulated rows by any numeric column — here, points.
const ranked = [...rows].sort((a, b) => b.pts - a.pts)4. Take the top ten
const leaders = ranked.slice(0, 10)5. Print the leaderboard
console.log("NBA points leaders") console.log(["player_id", "pts"].join('\t')) for (const row of leaders) { console.log([String(row.player_id ?? ''), String(row.pts ?? '')].join('\t')) }