Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion docs/v1/get-game-leaderboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A call to this endpoint will retrieve a given game's list of leaderboards, targe

## On-site Representation

A games's list of leaderboards can be found on on the game's page:
A game's list of leaderboards can be found on the game's page:

![Game Leaderboards](/game-leaderboards.png)

Expand All @@ -31,6 +31,24 @@ A games's list of leaderboards can be found on on the game's page:

::: code-group

```ts [NodeJS]
import {
buildAuthorization,
getGameLeaderboards,
} from "@retroachievements/api";

// First, build your authorization object.
const username = "<your username on RA>";
const webApiKey = "<your web API key>";

const authorization = buildAuthorization({ username, webApiKey });

// Then, make the API call.
const gameLeaderboards = await getGameLeaderboards(authorization, {
gameId: 14402,
});
```

```Kotlin
val credentials = RetroCredentials("<username>", "<web api key>")
val api: RetroInterface = RetroClient(credentials).api
Expand Down Expand Up @@ -83,11 +101,38 @@ if (response is NetworkResponse.Success) {
}
```

```json [NodeJS]
{
"count": 29,
"total": 29,
"results": [
{
"id": 104370,
"rankAsc": false,
"title": " South Island Conqueror",
"description": "Complete the game with the highest score possible",
"format": "VALUE",
"author": "Scott",
"authorUlid": "00003EMFWR7XB8SDPEHB3K56ZA",
"state": "active",
"topEntry": {
"user": "vani11a",
"ulid": "00003EMFWR7XB8SDPEHB3K56ZQ",
"score": 390490,
"formattedScore": "390,490"
}
}
// ...
]
}
```

:::

## Source

| Repo | URL |
| :--------- | :------------------------------------------------------------------------------------------------------------------- |
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetGameLeaderboards.php |
| api-js | https://github.com/RetroAchievements/api-js/blob/main/src/leaderboard/getGameLeaderboards.ts |
| api-kotlin | https://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt |