Edit Table
API for modifying leaderboard table settings.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/leaderboard/v20240301/table/edit - Method:
PUT - Authentication Required: Yes
DeviceInfo Inheritance
The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| uid | string | Required | Table code |
| record_type | string | Required | Record type ("highscore", "lowscore", "sum", "last") |
| record_sort_type | string | Required | Sort type ("asc", "desc") |
| record_priority | string | Required | Record priority ("Y" or "N") |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| Status | string | Processing status |
Unity C# Implementation
BaseResponse Class
Base class for all API responses.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
Field descriptions:
ErrorCode: Error codeMessage: Error messageWithdrawalKey: Key required for recovery if in withdrawal grace period (only provided for accounts in withdrawal grace period)BlockKey: Key provided if account is blocked (only provided for blocked accounts)
Enum Definitions
public enum RecordType
{
LOWSCORE,
HIGHSCORE,
SUM,
LAST
}
public enum SortType
{
DESC,
ASC
}
Edit Table Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class TableEdit
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/table/edit";
[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_type;
public string record_sort_type;
public string record_priority;
public IEnumerator Send(
string table_code,
RecordType recordType,
SortType recordSortType,
bool recordPriority,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
this.record_type = GetRecordType(recordType);
this.record_sort_type = GetSortType(recordSortType);
this.record_priority = recordPriority ? "Y" : "N";
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
// Create as a common function.
private string GetRecordType(RecordType value)
{
return value switch
{
RecordType.LOWSCORE => "lowscore",
RecordType.SUM => "sum",
RecordType.LAST => "last",
_ => "highscore",
};
}
private string GetSortType(SortType value)
{
if (value == SortType.ASC)
{
return "asc";
}
return "desc";
}
}
[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}
Usage Example
public void EditLeaderboardTable()
{
TableEdit.Req req = new TableEdit.Req();
StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordType: RecordType.LOWSCORE, // When lower score is better
recordSortType: SortType.ASC, // Ascending order
recordPriority: true,
onSuccess: res =>
{
Debug.Log("Table edited successfully");
Debug.Log($"Status: {res.Status}");
},
onError: error =>
{
Debug.LogError($"Table edit failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Record Type
- highscore: Keep only the highest score
- lowscore: Keep only the lowest score (suitable for racing games, etc.)
- sum: Sum all scores
- last: Update to the most recent score
Sort Type
- desc: Descending order (higher scores rank higher)
- asc: Ascending order (lower scores rank higher)
Table Edit Caution
Changing table settings may affect the existing ranking calculation method. Please modify carefully as it may impact scores already recorded by players.