Skip to main content
Version: 5.15.0

GetLeaderboard

public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid);
public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid, int limit);
public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid, int limit, int offset);

Parameters

ValueTypeDescriptionDefault
leaderboardUuidstringuuid of the ranking to look up-
limitintNumber of rank holders to look up (1 - 50)10
offsetintStarting point of the ranking to look up (0 or more)0

The leaderboardUuid value can be checked using the following methods:

Description

Looks up the list of rank holders in your group using a uuid value.

  • In the case of guilds that do not belong to any groups, NULL group's leaderboard is looked up.

    In the case of joint ranks, gamer_ids (member numbers) are sorted lexicographically according to the set rank-sorting criteria (ascending/descending order).

  • This method cannot be called via SendQueue.

BackendGuildLeaderboardReturnObject

namespace BackEnd.Leaderboard
{
public class GuildLeaderboardItem
{
public string guildInDate;
public string guildName;
public string score;
public string index;
public string rank;
}

public class BackendGuildLeaderboardReturnObject : BackendReturnObject
{
public long GetTotalCount();
public List<GuildLeaderboardItem> GetGuildLeaderboardList();
}
}

Example

Synchronous

BackEnd.Leaderboard.BackendGuildLeaderboardReturnObject bro = null;
// Look up the 1st - 10th rank holders in the leaderboardUuid ranking
bro = Backend.Leaderboard.Guild.GetLeaderboard("01920443-c070-79d6-b268-5847aad4c76e");
// Look up the 1st - 50th rank holders in the leaderboardUuid ranking
bro = Backend.Leaderboard.Guild.GetLeaderboard("01920443-c070-79d6-b268-5847aad4c76e", 50);
// Look up the 11th - 20th rank holders in the leaderboardUuid ranking
bro = Backend.Leaderboard.Guild.GetLeaderboard("01920443-c070-79d6-b268-5847aad4c76e", 10, 10);

if (bro.IsSuccess() == false)
{
return;
}

Debug.Log("Total number of guilds registered to the leaderboard : " + bro.GetTotalCount());
foreach (BackEnd.Leaderboard.GuildLeaderboardItem item in bro.GetGuildLeaderboardList())
{
Debug.Log($"Rank {item.rank} : {item.guildName}");
Debug.Log(item.ToString());
}

Asynchronous

// Look up the 1st - 10th rank holders in the leaderboardUuid ranking
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", bro=> {
if(bro.IsSuccess() == false) {
return;
}

Debug.Log("Total number of guilds registered to the leaderboard : " + bro.GetTotalCount());
foreach (BackEnd.Leaderboard.GuildLeaderboardItem item in bro.GetGuildLeaderboardList())
{
Debug.Log($"Rank {item.rank} : {item.guildName}");
Debug.Log(item.ToString());
}
});

// Look up the 1st - 50th rank holders in the leaderboardUuid ranking
Backend.Leaderboard.User.GetLeaderboard("leaderboardUuid", 50, callback=> {
// Post-process
});
// Look up the 11th - 20th rank holders in the leaderboardUuid ranking
Backend.Leaderboard.User.GetLeaderboard("leaderboardUuid", 10, 10, callback=> {
// Post-process
});

ReturnCase

Success cases

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

When the lookup is successful but the rank holder is not in the lookup range
statusCode : 200
message : Success
returnValue : {"rows":[]}

Error cases

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

When the uuid does not exist
StatusCode : 404
ErrorCode : NotFoundException
Message : leaderboard not found, leaderboard cannot be found

GetReturnValuetoJSON

{
"rows": [
{
"guildName": "guild1",
"guildInDate": "2024-05-08T07:17:22.915Z",
"rank": 1,
"index": 0,
"score": "36"
},
{
"guildName": "guild2",
"guildInDate": "2024-05-08T07:17:22.408Z",
"rank": 2,
"index": 1,
"score": "32"
}
],
"totalCount": 18
}