Skip to main content
Version: 5.15.0

GetPastLeaderboard

public BackendUserPastLeaderboardReturnObject GetPastLeaderboard(string leaderboardUuid, int limit = 10, int offset = 0)

Parameters

ValueTypeDescriptionDefault
leaderboardUuidstringuuid of the leaderboard to look up-
limitintNumber of leaderboard users to load (1 - 100)10
offsetintuuid of the leaderboard to look up (above 0)0

Description

Loads the last leaderboard rankings before the renewal of the leaderboard that has been measured for leaderboard rewards.

  • This is only possible for leaderboards with rewards.
  • Only the past leaderboards for users who have received leaderboards rewards are displayed.
    • If leaderboard rewards are given to the top 10, past leaderboards from 11th place and below cannot be loaded.
    • Users that are not on the leaderboard rankings but have received the reward for all are not included in the past leaderboards.
  • You cannot load the past leaderboards for a certain user or for yourself.
  • Among the past leaderboards, the single latest past leaderboard will be loaded.
    • For daily leaderboards, the past leaderboards for the previous day will be loaded, and the leaderboards for 2 days prior cannot be loaded.
  • If a number smaller than 0 is entered for the limit, it will be adjusted to 1. If a number exceeding 100 is entered, it will be adjusted to 100.
  • If a number smaller than 0 is entered for the offset, it will be adjusted to 0.
  • Users without nicknames will be marked as "".
  • This method cannot be called via SendQueue.
For withdrawn users

If there are withdrawn users in the past leaderboards list, the user’s nickname and inDate columns will not exist.
Check the columns using jsonData.ContainsKey("nickname") before processing the data.

Withdrawn user

{"score":"7835","rank":1}

General user

{"score":"7833","rank":3,"nickname":"user1","inDate":"2024-03-06T05:59:53.523Z"}

BackendUserPastLeaderboardReturnObject

namespace BackEnd.Leaderboard
{
public class UserPastLeaderboardItem
{
public string nickname;
public string inDate;
public string score;
public string rank;
}

public class BackendUserPastLeaderboardReturnObject : BackendReturnObject
{
public List<UserPastLeaderboardItem> GetUserPastLeaderboardList();
}
}

Example

Synchronous


// Leaderboard ranks 1 to 10
BackEnd.Leaderboard.BackendUserPastLeaderboardReturnObject bro = Backend.Leaderboard.User.GetPastLeaderboard("01920445-a435-759e-bc3b-048a1e7a87aa");

foreach(BackEnd.Leaderboard.UserPastLeaderboardItem item in bro.GetUserPastLeaderboardList())
{
string name = $"[{item.rank}] {item.nickname} : {item.score}";
Debug.Log(item);
}

// Leaderboard ranks 11 (offset + 1) to 111 ((offset + 1 + limit)
Backend.Leaderboard.User.GetPastLeaderboard("a61c6980-db5f-11ee-95a9-73cbb1225013", 100, 10);

Asynchronous

Backend.Leaderboard.User.GetPastLeaderboard("a61c6980-db5f-11ee-95a9-73cbb1225013", 10, 0, callback => {
foreach(BackEnd.Leaderboard.UserPastLeaderboardItem item in callback.GetUserPastLeaderboardList())
{
string name = $"[{item.rank}] {item.nickname} : {item.score}";
Debug.Log(item);
}
});

ReturnCase

Success cases

When the lookup is successful
statusCode : 200
message : Success
returnValue : refer to GetReturnValuetoJSON

Error cases

If reward calculation has not been conducted for the past leaderboards
statusCode : 200
message : Success
returnValue : {"rows":[]}

When the uuid is null or string.Empty
statusCode : 400
errorCode : ValidationException
message : leaderboardUuid is null or empty

When there is an attempt to look up with a non-existent uuid
statusCode : 404
errorCode : NotFoundException
message : leaderboard not found, leaderboard cannot be found.

When an attempt is made to look up the past leaderboards for the cumulative leaderboards
statusCode : 428
errorCode : Precondition Required
message : Precondition Required rank initial type

GetReturnValuetoJSON

{
"rows": [
{
"score": "7835", // The nickname and inDate will not be printed for withdrawn users.
"rank": 1
}
{
"score": "5834",
"rank": 2,
"nickname": "user2",// Users without nicknames will be printed as ""
"inDate": "2024-03-06T05:59:53.523Z"
},
{
"score": "5121",
"rank": 3,
"nickname": "user3",
"inDate": "2024-03-06T05:59:51.568Z"
}
]
}