Leaderboards
Kit leaderboards and the overall leaderboard.
GET /leaderboards/:kit
The best players of a kit by ELO. Only players with at least one ranked game in the kit are listed.
| Part | Meaning |
|---|---|
{kit} | A kit name from GET /kits, or overall |
limit | How many rows, 1 to 100. Default 10 |
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/leaderboards/nodebuff?limit=3"{
"ok": true,
"data": [
{ "rank": 1, "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve", "elo": 1612, "wins": 140, "losses": 61 },
{ "rank": 2, "uuid": "853c80ef-3c37-49fd-aa49-938b674adae6", "name": "Alex", "elo": 1588, "wins": 98, "losses": 47 },
{ "rank": 3, "uuid": "f7c77d99-9f15-4a66-a87d-c4a51ef7e3c3", "name": "Jeb", "elo": 1540, "wins": 77, "losses": 52 }
]
}| Field | Meaning |
|---|---|
rank | Position, starting at 1 |
elo | ELO in the kit |
wins, losses | Ranked results in the kit |
The leaderboard reads the same database data as the in-game boards and holograms, so the values match. An unknown kit gives 404:
{"ok":false,"error":{"code":"not_found","message":"no kit named bridge2"}}Kit names are matched in lower case, so NoDebuff and nodebuff are the same.
The overall leaderboard
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/leaderboards/overall?limit=5"The overall rank uses each player's global ELO, the average over the kits they played ranked. Only players with at least leaderboard.overall-min-games ranked games in total appear (10 by default, in matchmaking.yml). wins and losses are the ranked totals over all kits.
{
"ok": true,
"data": [
{ "rank": 1, "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve", "elo": 1498, "wins": 212, "losses": 95 }
]
}Caching
Leaderboards are cached for cache-seconds (5 by default) per kit and limit. Many clients asking for the same board cost one query.
Examples
A Markdown table for a Discord or website post:
const kits = await (await fetch(`${MD_URL}/kits`, { headers })).json();
for (const kit of kits.data) {
const board = await (await fetch(`${MD_URL}/leaderboards/${kit}?limit=5`, { headers })).json();
console.log(`### ${kit}`);
board.data.forEach((r) => console.log(`${r.rank}. ${r.name} - ${r.elo} (${r.wins}W ${r.losses}L)`));
}With a short wait between kits to respect the heavy limit of 5 requests per second:
await new Promise((r) => setTimeout(r, 250));All boards at once in bash:
for kit in $(curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/kits" | jq -r '.data[]'); do
echo "== $kit"
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/leaderboards/$kit?limit=3" \
| jq -r '.data[] | "\(.rank). \(.name) \(.elo)"'
sleep 0.3
done== nodebuff
1. Steve 1612
2. Alex 1588
3. Jeb 1540
== sumo
1. Alex 1403
2. Jeb 1377
3. Steve 1350Python, the top player of every kit:
kits = requests.get(f"{BASE}/kits", headers=HEADERS).json()["data"]
for kit in kits:
rows = requests.get(f"{BASE}/leaderboards/{kit}", params={"limit": 1}, headers=HEADERS).json()["data"]
if rows:
print(f"{kit}: {rows[0]['name']} ({rows[0]['elo']})")
time.sleep(0.3)