CreateLeaderboard
caution
WARNING: This call, CreateLeaderboard()
, has been deprecated and replaced with SysCreateLeaderboardConfig()
.
Creates a leaderboard under the context of the current game. You can optionally send a user-defined json string of data with the created leaderboard. This string could include information relevant to the created leaderboard.
Service | Operation |
---|---|
leaderboard | CREATE_LEADERBOARD |
Method Parameters
Parameter | Description |
---|---|
leaderboardId | The leaderboard to create |
leaderboardType | Leaderboard type |
rotationType | Type of rotation |
rotationReset | Date to start the rotation (date in millis) |
retainedCount | How many previous rotations to keep |
data | Optional user-defined data to relevant to the created leaderboard |
numDaysToRotate | Optional parameter for use only with DAYS rotation type |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
//cloud code only
//cloud code only
//cloud code only
//cloud code only
//cloud code only
// Cloud Code only. To view example, switch to the Cloud Code tab
var leaderboardId = "testCreate";
var type = "HIGH_VALUE";
var rotationType = "WEEKLY";
var rotationReset = Date.now();
var versionsToRetain = 6;
var data = { "test": 1234 };
var leaderboardProxy = bridge.getLeaderboardServiceProxy();
var retVal = leaderboardProxy.createLeaderboard(
leaderboardId,
type,
rotationType,
rotationReset,
versionsToRetain,
data
);
//For DAYS rotation type
var leaderboardId = "testCreate";
var type = "HIGH_VALUE";
var rotationType = "DAYS";
var rotationReset = Date.now();
var versionsToRetain = 6;
var data = { "test": 1234 };
var numDaysToRotate = 3;
var leaderboardProxy = bridge.getLeaderboardServiceProxy();
var retVal = leaderboardProxy.createLeaderboard(
leaderboardId,
type,
rotationType,
rotationReset,
versionsToRetain,
data,
numDaysToRotate
);
{
"service": "leaderboard",
"operation": "CREATE_LEADERBOARD",
"data": {
"leaderboardId": "default",
"leaderboardType": "HIGH_VALUE",
"rotationType": "DAYS",
"rotationResetTime": "[[#ts+60000]]",
"retainedCount": 2,
"numDaysToRotate": 5,
"data": {
"street": "1309 Carling"
}
}
}
JSON Response
{
"status": 200,
"data": null
}