Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add get user game leaderboards docs #68

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Click the function names to open their complete docs on the docs site.

- [Leaderboards (by gameID)](https://api-docs.retroachievements.org/v1/get-game-leaderboards.html) - Get a given games's list of leaderboards.
- [Entries](https://api-docs.retroachievements.org/v1/get-leaderboard-entries.html) - Get a given leadboard's entries.
- [User game leaderboards](https://api-docs.retroachievements.org/v1/get-user-game-ladearboards.html) - Get a given user and game leaderboards.

### System

Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export default defineConfig({
text: "Entries",
link: "/v1/get-leaderboard-entries",
},
{
text: "User Leaderboards (by gameID)",
link: "/v1/get-user-game-leaderboards",
},
],
},
{
Expand Down
71 changes: 71 additions & 0 deletions docs/v1/get-user-game-leaderboards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<script setup>
import SampleRequest from '../components/SampleRequest.vue';
</script>

# User Game Leaderboards

A call to this endpoint will retrieve a user's list of leaderboards for a given game, targeted by the game's ID.

[[toc]]

## On-site Representation

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

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

This endpoint will only return the leaderboards for the user given in the request. If the user has not submitted a score for a leaderboard, it will not be included in the response.

## HTTP Request

<SampleRequest httpVerb="GET">https://retroachievements.org/API/API_GetUserGameLeaderboards.php?i=1&u=zuliman92</SampleRequest>

### Query Parameters

| Name | Required? | Description |
| :--- | :-------- | :----------------------------------------------------------- |
| `y` | Yes | Your web API key. |
| `i` | Yes | The target game ID. |
| `u` | Yes | The username of the user to retrieve leaderboards for. |
| `c` | | Count, number of records to return (default: 200, max: 500). |
| `o` | | Offset, number of entries to skip (default: 0). |

## Client Library

Not yet supported.

## Response

::: code-group

```json [HTTP Response]
{
"Count": 10,
"Total": 64,
"Results": [
{
"ID": 19062,
"RankAsc": true,
"Title": "New Zealand One",
"Description": "Complete New Zealand S1 in least time",
"Format": "MILLISECS",
"UserEntry": {
"User": "zuliman92",
"Score": 12620,
"FormattedScore": "2:06.20",
"Rank": 2,
"DateUpdated": "2024-12-12T16:40:59+00:00"
}
},
...
]
}
```

:::

## Source

| Repo | URL |
| :---- | :------------------------------------------------------------------------------------------------ |
| RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetUserGameLeaderboards.php |