Skip to main content
Version: 5.15.0

UpdateMyDataAndRefreshLeaderboard

public BackendReturnObject UpdateMyDataAndRefreshLeaderboard(string leaderboardUuid, string tableName, string rowIndate, Param param);

Note

If a table registered to a leaderboard is changed to Public, 400 bad public Table error will occur and data will not be updated.

As such, we advise you to not change a registered table's status to Public.

Parameters

ValueTypeDescription
leaderboardUuidstringuuid of the leaderboard to update
tableNamestringName of the table to update
rowIndatestringinDate of the row to update
paramParamValue to update

The leaderboardUuid value can be checked using the following methods:

Description

Updates the uuid leaderboard as well as the data stored in the row of the table.

  • To update the leaderboard, the user to perform the task must insert the relevant table once and create a row.
  • In rowIndate, the inDate value of the inserted row must be indicated.
  • UpdateMyDataAndRefreshLeaderboard is a method where the leaderboard update function is added to the Backend.GameData.Update method.
  • Data updated without using the UpdateMyDataAndRefreshLeaderboard method is not reflected in the leaderboard (regardless of the leaderboard score and additional fields).

The param must meet the following conditions:

  • When generating a leaderboard, the value of the selected column must be included.

    The range of column values selected when creating a leaderboard (values to be used as scores) must be as follows. Values out of that range may not be stored properly (e.g., rounded up or down), and cause an error when looking up the leaderboard in the SDK.
    Integer: -9007199254740992 - 9007199254740992 (-2^53 ~ 2^53)
    Real number: -3.40282347E+38F - 3.40282347E+38F (float.MinValue ~ float.MaxValue)

Additional field

  • When generating a leaderboard, the column of the selected additional field does not have to be included.
  • Other columns may be included as well.
  • The value to be updated in the table is determined by the schema definition/non-definition rule of each table.
  • Additional fields can contain up to 256byte of data, and an error will occur if 257 bytes or larger sized data is registered.
  • Even if the param does not include additional fields, the additional fields are registered to the leaderboard if they exist in the rowIndate's data.

The param must meet the following conditions:

  • When generating a leaderboard, the value of the selected column must be included.

    The range of column values selected when creating a leaderboard (values to be used as scores) must be as follows.
    Values out of that range may not be stored properly (e.g., rounded up or down), and cause an error when looking up the leaderboard in the SDK.

    Integer: -9007199254740992 - 9007199254740992 (-2^53 ~ 2^53)
    Real number: -3.40282347E+38F - 3.40282347E+38F (float.MinValue ~ float.MaxValue)

  • When generating a leaderboard, the column of the selected additional field does not have to be included.
  • Other columns may be included as well.
  • The value to be updated in the table is determined by the schema definition/non-definition rule of each table.

Example

Synchronous

Param param = new Param();
param.Add("score", i);
param.Add("extraData", "additional info");

Backend.Leaderboard.User.UpdateMyDataAndRefreshLeaderboard("leaderboard uuid", "table name", "row inDate to be updated", param);

Asynchronous

Param param = new Param();
param.Add("score", i);
param.Add("extraData", "additional info");

Backend.Leaderboard.User.UpdateMyDataAndRefreshLeaderboard("leaderboard uuid", "table name", "inDate of the row to update", param, callback =>
{
// Post-process
});

ReturnCase

Success cases

When successful
statusCode : 204
message : Success

Error cases

(Schema) When the data type of the column that declared the schema is different from the data type of the column inserted to param
statusCode : 400
errorCode : BadParameterException
message : bad {data type of the column} dataType, Invalid {data type of the column} dataType

When the uuid is null or string.Empty
StatusCode : 400
ErrorCode : ValidationException
Message : leaderboardUuid is null or string.Empty

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

When the table is not the one registered as a leaderboard field upon creating the leaderboard
statusCode : 400
errorCode : BadParameterException
message : bad table, Invalid table

When the leaderboard to be updated is not a user leaderboard
statusCode : 400
errorCode : BadParameterException
message : bad table, Invalid table

When the inDate is null or string.Empty
statusCode : 400
errorCode : BadParameterException
message : bad inDate must be, Invalid inDate

When the column registered as a leaderboard field upon creating the leaderboard is not in param
statusCode : 400
errorCode : BadParameterException
message : bad rankData column, Invalid rankData column

When updated to a value other than int, long double, and float
statusCode : 400
errorCode : BadParameterException
message : bad value must number, The value must be a number

(Schema) When a column whose schema is not declared is in param
statusCode : 404
errorCode : NotFoundException
message : column not found, column cannot be found

When a non-existent inDate is entered / When another person's row Indate is entered
statusCode : 404
errorCode : NotFoundException
message : data not found, data cannot be found

When a call is attempted during reset time (within 1 hour of reset)
statusCode : 428
errorCode : Precondition Required
message : Precondition Required ranking is being counted

If the reset time is 2 pm in Korean time, an error occurs between 2 pm and 3 pm.

When the user tries to renew an expired one-time leaderboard
statusCode : 428
errorCode : Precondition Required
message : Precondition Required ranking is being counted

Sample Code

public void UpdateLeaderboardTest()
{
string tableName = "score";
string rowIndate = string.Empty;
string leaderboardUuid = "fe8ffa20-1db6-11ec-83a0-77f4e266a1f3";

Param param = new Param();
param.Add("score", 10);

var bro = Backend.GameData.Get("score", new Where());

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

if(bro.FlattenRows().Count > 0)
{
rowIndate = bro.FlattenRows()[0]["inDate"].ToString();
}
else
{
var bro2 = Backend.GameData.Insert(tableName, param);

if(bro2.IsSuccess())
{
rowIndate = bro2.GetInDate();
}
else
{
Debug.LogError(bro2);
return;
}
}

if(rowIndate == string.Empty)
{
return;
}

var rankBro = Backend.Leaderboard.User.UpdateMyDataAndRefreshLeaderboard(leaderboardUuid, tableName, rowIndate, param);
if(rankBro.IsSuccess())
{
Debug.Log("Leaderboard registration successful");
}
else
{
Debug.Log("Leaderboard registration failed : " + rankBro);
}
}