Skip to main content

Query Player

API for querying a specific player's leaderboard record.

URL Verification

This API uses the service-api.playnanoo.com domain.

API Information

  • URL: https://service-api.playnanoo.com/leaderboard/v20240301/show
  • 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

ParameterTypeRequiredDescription
uidstringRequiredTable code
record_idstringRequiredRecord ID (player identifier)

Response Data

Res Class

FieldTypeDescription
RankintPlayer's rank
RotationCountintCurrent season number
RecordIdstringRecord ID
ScoreintScore
ExtraDatastringAdditional data (JSON string)

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 code
  • Message: Error message
  • WithdrawalKey: 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)

Query Player Class

using System;
using System.Collections;
using UnityEngine.Networking;

public class PlayerShow
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/show";

[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;

public IEnumerator Send(string table_code, string recordId, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;

yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public int Rank;
public int RotationCount;
public string RecordId;
public int Score;
public string ExtraData;
}
}

Usage Example

public void ShowPlayerRecord()
{
PlayerShow.Req req = new PlayerShow.Req();

StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
onSuccess: res =>
{
Debug.Log("Player record retrieved successfully");
Debug.Log($"Rank: {res.Rank}");
Debug.Log($"Score: {res.Score}");
Debug.Log($"Season: {res.RotationCount}");

// Parse ExtraData if present
if (!string.IsNullOrEmpty(res.ExtraData))
{
Debug.Log($"Additional data: {res.ExtraData}");
}
},
onError: error =>
{
Debug.LogError($"Player record retrieval failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Record Query

This API queries a specific player's record for the current season. To query records from previous seasons, use the previous season query API.

Parsing Additional Data

ExtraData is returned as a JSON string. You can convert it to an object using Unity's JsonUtility.