Skip to main content
Version: 5.11.8

GetRankList

public BackendReturnObject GetRankList(string rankUuid);
public BackendReturnObject GetRankList(string rankUuid, int limit);
public BackendReturnObject GetRankList(string rankUuid, int limit, int offset);

Note

Old version rankings cannot use this method.

Parameters

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

The rankUuid value can be checked using the following methods:

Description

Looks up the list of rank holders registered in the ranking using a uuid value.
In the case of joint ranks, gamer_ids(member numbers) are sorted lexicographically according to the set rank-sorting criteria(ascending/descending order).

Example

Synchronous

// Look up the 1st - 10th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid");
// Look up the 1st - 100th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid", 100);
// Look up the 11th - 20th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid", 10, 10);

Asynchronous

// Look up the 1st - 10th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid", callback=> {
// Post-process
});
// Look up the 1st - 100th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid", 100, callback=> {
// Post-process
});
// Look up the 11th - 20th rank holders in the rankUuid ranking
Backend.URank.User.GetRankList("rankUuid", 10, 10, callback=> {
// Post-process
});

SendQueue

// Look up the 1st - 10th rank holders in the rankUuid ranking
SendQueue.Enqueue(Backend.URank.User.GetRankList, "rankUuid", callback=> {
// Post-process
});
// Look up the 1st - 100th rank holders in the rankUuid ranking
SendQueue.Enqueue(Backend.URank.User.GetRankList, "rankUuid", 100, callback=> {
// Post-process
});
// Look up the 11th - 20th rank holders in the rankUuid ranking
SendQueue.Enqueue(Backend.URank.User.GetRankList, "rankUuid", 10, 10, callback=> {
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When the lookup is successful but the rank holder is not in the lookup range
statusCode : 200

returnValue : {"rows":[]}

Error cases

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

When the uuid does not exist
statusCode : 404
errorCode : NotFoundException

GetReturnValuetoJSON

{
"rows": [
{
// Gamer inDate of the user
"gamerInDate": {
"S": "2021-03-11T06:38:46.817Z"
},
// User's nickname
"nickname": {
"S": "Nicknames"
},
// Additional field
// Name and value of the column are displayed.
// 'extraScore' if the column name of the additional field is 'extraScore'
"extraScore": {
"N": "4577"
},
// Score
// Column names are unified as 'score'.
// It will be called 'score' even if the column name of the ranking field is 'power.'
"score": {
"N": "199"
},
// offset
"index": {
"N": 0
},
// User's rank
"rank": {
"N": 1
}
},
// and etc...
],
// Total number of rank holders registered in the ranking
"totalCount":100
}

Sample code

public class RankItem
{
public string gamerInDate;
public string nickname;
public string score;
public string index;
public string rank;
public string extraData = string.Empty;
public string extraName = string.Empty;
public string totalCount;

public override string ToString()
{
string str = $"UserinDate:{gamerInDate}\nNikckname:{nickname}\nScore:{score}\nSort:{index}\nPlacement:{rank}\nTotal:{totalCount}\n";
if(extraName != string.Empty)
{
str += $"{extraName}:{extraData}\n";
}
return str;
}
}
public void GetMyRankTest()
{
string userUuid = "81272320-8c40-112b-b174-d9233f6bd0e8";

int limit = 100;

List<RankItem> rankItemList = new List<RankItem>();

BackendReturnObject bro = Backend.URank.User.GetRankList(userUuid, limit);

if(bro.IsSuccess())
{
LitJson.JsonData rankListJson = bro.GetFlattenJSON();

string extraName = string.Empty;

for(int i = 0; i < rankListJson["rows"].Count; i++)
{
RankItem rankItem = new RankItem();

rankItem.gamerInDate = rankListJson["rows"][i]["gamerInDate"].ToString();
rankItem.nickname = rankListJson["rows"][i]["nickname"].ToString();
rankItem.score = rankListJson["rows"][i]["score"].ToString();
rankItem.index = rankListJson["rows"][i]["index"].ToString();
rankItem.rank = rankListJson["rows"][i]["rank"].ToString();
rankItem.totalCount = rankListJson["totalCount"].ToString();

if(rankListJson["rows"][i].ContainsKey(rankItem.extraName))
{
rankItem.extraData = rankListJson["rows"][i][rankItem.extraName].ToString();
}

rankItemList.Add(rankItem);
Debug.Log(rankItem.ToString());
}
}
}