Skip to main content
Version: 5.7.0

GetGlobalLeaderboardPageByVersion

NOTE: The friend summary data is returned for each record in the leaderboard.

NOTE: "timeBeforeReset" is only returned when the requested version is also the active version.

Method returns a page of global leaderboard results. By using a non-current version id, the user can retrieve a historical leaderboard.

tip

See GetGlobalLeaderboardVersions method to retrieve the version id.

ServiceOperation
leaderboardGET_GLOBAL_LEADERBOARD_PAGE

Method Parameters

ParameterDescription
leaderboardIdThe id of the leaderboard
sortOrderSort order of page. ("HIGH_TO_LOW" or "LOW_TO_HIGH")
startIndexThe rank at which to start the page.
endIndexThe rank at which to end the page.
versionIdThe historical version to retrieve.

Usage

http://localhost:3000
string leaderboardId = "default";
SortOrder sortOrder = BrainCloudSocialLeaderboard.SortOrder.HIGH_TO_LOW;
int startIndex = 0;
int endIndex = 9;
int versionId = -1;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.LeaderboardService.GetGlobalLeaderboardPageByVersion(leaderboardId, sortOrder, startIndex, endIndex, versionId, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"leaderboard": [
{
"playerId": "9073dff7-0df6-437e-9be6-39cd704dcoj4",
"score": 100,
"data": null,
"createdAt": 1401385959596,
"updatedAt": 1401385959596,
"index": 0,
"rank": 1,
"name": "",
"summaryFriendData": null,
"pictureUrl": null
},
{
"playerId": "7c107e9f-ab48-492d-a000-defec6237700",
"score": 10,
"data": null,
"rewarded": false,
"createdAt": 1401385898407,
"updatedAt": 1401385898407,
"index": 1,
"rank": 2,
"name": "",
"summaryFriendData": null,
"pictureUrl": null
}
],
"leaderboardSize": 31,
"moreBefore": false,
"moreAfter": true,
"timeBeforeReset": 588182412,
"server_time": 1395840957588
}
}