Edit Player Data
API for modifying additional data of a leaderboard record.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/leaderboard/v20240301/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_id | string | Required | Record ID (player identifier) |
| extra_data | string | Required | Additional data (JSON string) |
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)
Edit Player Data Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class PlayerEdit
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/edit";
[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;
public string extra_data;
public IEnumerator Send(string table_code, string recordId, string extraData, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;
if (!string.IsNullOrEmpty(extraData)) this.extra_data = extraData;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}
Usage Example
public void EditPlayerData()
{
PlayerEdit.Req req = new PlayerEdit.Req();
// Serialize additional data to JSON
var extraData = new
{
level = 15,
character = "warrior",
achievement = "first_win"
};
string jsonExtra = JsonUtility.ToJson(extraData);
StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
extraData: jsonExtra,
onSuccess: res =>
{
Debug.Log("Additional data updated successfully");
Debug.Log($"Status: {res.Status}");
},
onError: error =>
{
Debug.LogError($"Additional data update failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Additional Data Editing
This API modifies only the extra_data without changing the score. To change the score, use the score recording API.
JSON Serialization
extra_data must be in JSON string format. You can use Unity's JsonUtility to convert objects to JSON strings.