Leaderboard
Leaderboard
The Leaderboard API allows clients to retrieve leaderboard positions for gamers and applications. It supports operations to get a gamer's position within a leaderboard and to fetch all leaderboards associated with an application.
info
Base Endpoint: /api/v1/
Available Endpoints
1. Get Gamer Leaderboard Position
- Method & Path:
GET /leaderboard
- Description: Retrieves the leaderboard position of a gamer based on specified criteria.
- Query Parameters:
statId
: The ID of the statistic to filter the leaderboard by.repeatInterval
: The interval for repeating leaderboard calculations. (DAILY
,WEEKLY
,MONTHLY
,NEVER
)aggregationType
: The type of aggregation used for leaderboard calculations. (SUM
,MAX
)
- Headers:
Authorization
: Required. A valid authentication token.
- Response:
- A JSON object. containing the following fields:
gamerPosition
: JSON object containing the position of requesting gamer for that leaderboardposition
: Position of the gamer in the leaderboardgamer
: JSON object containing information about requesting gamerid
: Unique ID of the gamername
: Display Name of the gameravatar
: Avatar of the gamer
stat
: JSON object containing detail about statid
: Unique Id of the statname
: Name of the statvalue
: Requesting player's value for the stat
values
: Array of JSON object containing object ofposition
: Position of a gamer in the leaderboardgamer
: JSON object containing information about gamerid
: Unique Id of the gamername
: Display name of the gameravatar
: Avatar of the gamer
stat
: JSON object containing details about statid
: Unique Id of the statname
: Name of the statvalue
: Player's value for the stat
- A JSON object. containing the following fields:
cURL Command
curl --request GET \
--url 'https://api.yarsaplay.com/api/v1/leaderboard?statId=&repeatInterval=DAILY&aggregationType=SUM' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"gamerPosition": {
"gamer": {
"avatar": "<string>",
"id": "<uuid>",
"name": "<string>"
},
"position": "<number>",
"stat": {
"id": "<uuid>",
"name": "<string>",
"value": "<number>"
}
},
"values": [
{
"gamer": {
"avatar": "<string>",
"id": "<uuid>",
"name": "<string>"
},
"position": "<number>",
"stat": {
"id": "<uuid>",
"name": "<string>",
"value": "<number>"
}
},
{
"gamer": {
"avatar": "<string>",
"id": "<uuid>",
"name": "<string>"
},
"position": "<number>",
"stat": {
"id": "<uuid>",
"name": "<string>",
"value": "<number>"
}
}
]
}
2. Get Application Leaderboards
- Method & Path:
GET /:applicationId/leaderboards
- Description: Fetches all leaderboards associated with a given application.
- URL Parameters:
applicationId
: The unique identifier of the application.
- Headers:
Authorization
: Required. A valid authentication token.
- Response:
- An array of JSON objects, each representing configured leaderboard for the application
id
: ID of the configured leaderboardname
: Name of the configured leaderboardresetIntervalType
:Interval when the leaderboard resets (DAILY
,WEEKLY
,MONTHLY
,NEVER
)aggregationType
: The type of aggregation used for leaderboard calculations. (SUM
,MAX
)applicationStat
: JSON object containing detail about the stat for leaderboardid
: ID of the statname
: Name of the stat
- An array of JSON objects, each representing configured leaderboard for the application
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/__APPLICATIONID__/leaderboards
Response Body
[
{
"aggregationType": "<string>",
"applicationStat": {
"id": "<uuid>",
"name": "<string>"
},
"id": "<uuid>",
"name": "<string>",
"resetIntervalType": "<string>"
},
{
"aggregationType": "<string>",
"applicationStat": {
"id": "<uuid>",
"name": "<string>"
},
"id": "<uuid>",
"name": "<string>",
"resetIntervalType": "<string>"
}
]