Skip to main content
Version: 5.9.6

UpdateUserScore

public BackendReturnObject UpdateUserScore(string rankUuid, string tableName, string rowIndate, Param param);

Note
Old version rankings cannot use this method.
Note
If a table registered to a ranking 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
rankUuidstringuuid of the ranking to update
tableNamestringName of table to update
rowIndatestringinDate of the row to update
paramParamValue to update

The rankUuid value can be checked using the following methods:

Description

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

  • To update the ranking, 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.
  • UpdateUserScore is a method where the ranking update function is added to the Backend.GameData.Update method.
  • Data updated without using the UpdateUserScore method is not reflected in the ranking(regardless of the ranking score and additional fields).

The param must meet the following conditions:

  • When generating a ranking, the value of the selected column must be included.
    The range of column values selected when creating a ranking(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 ranking 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 ranking, 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 information");

Backend.URank.User.UpdateUserScore("ranking uuid", "table name", "inDate of the row to update", param);

Asynchronous

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

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

SendQueue

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

SendQueue.Enqueue(Backend.URank.User.UpdateUserScore, "ranking uuid", "table name", "inDate of the row to update", param, callback =>
{
// Post-process
});

Return cases

Success cases

When successful
statusCode : 204

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

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

When the table is not the one registered as a ranking field upon creating the ranking
statusCode : 400
errorCode : BadParameterException

When the ranking to be updated is not a user ranking
statusCode : 400
errorCode : BadParameterException

When the inDate is null or string.Empty
statusCode : 400
errorCode : BadParameterException

When the table registered as a ranking field upon creating the ranking is not in param
statusCode : 400
errorCode : BadParameterException

When updated to a value other than int, long double, and float
statusCode : 400
errorCode : BadParameterException

(Schema) When a column whose schema is not declared is in param
statusCode : 404
errorCode : NotFoundException

When a non-existent inDate is entered / When another person's row Indate is entered
statusCode : 404
errorCode : NotFoundException

When there is an attempt to update the ranking during UTC +9 04:00 - 05:00
statusCode : 428
errorCode : Precondition Required

When there is an attempt to update the ranking between 4 am - 5 am in Korean time

When there is an attempt to update an expired one-time ranking
statusCode : 428
errorCode : Precondition Required

Sample code

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

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

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

if(bro.IsSuccess())
{
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
{
return;
}

}
}
else
{
return;
}

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

var rankBro = Backend.URank.User.UpdateUserScore(rankingUUID, tableName, rowIndate, param);
if(rankBro.IsSuccess())
{
Debug.Log("Ranking registration successful");
}
else
{
Debug.Log("Ranking registration failed : " + rankBro);
}
}