Skip to main content

Query Table

API for querying leaderboard table information.

URL Verification

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

API Information

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

Response Data

Res Class

FieldTypeDescription
RotationstringRotation method
RotationCountintCurrent season number
RotationTimeLeftintTime remaining until season ends (seconds)
RecordTypestringRecord type
RecordSortTypestringSort type
TotalIdsdoubleTotal number of records

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 Table Class

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

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

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

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

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

[Serializable]
public class Res : BaseResponse
{
public string Rotation;
public int RotationCount;
public int RotationTimeLeft;
public string RecordType;
public string RecordSortType;
public double TotalIds;
}
}

Usage Example

public void ShowLeaderboardTable()
{
TableShow.Req req = new TableShow.Req();

StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
onSuccess: res =>
{
Debug.Log("Table retrieved successfully");
Debug.Log($"Rotation method: {res.Rotation}");
Debug.Log($"Current season: {res.RotationCount}");
Debug.Log($"Time remaining until season ends: {res.RotationTimeLeft} seconds");
Debug.Log($"Record type: {res.RecordType}");
Debug.Log($"Sort type: {res.RecordSortType}");
Debug.Log($"Total number of records: {res.TotalIds}");

// Display time remaining to user
TimeSpan timeLeft = TimeSpan.FromSeconds(res.RotationTimeLeft);
Debug.Log($"Until season ends: {timeLeft.Days} days {timeLeft.Hours} hours {timeLeft.Minutes} minutes");
},
onError: error =>
{
Debug.LogError($"Table retrieval failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Table Information

Through this API, you can check the current settings and status of the leaderboard. You can obtain information such as whether the season is about to end and how many players are currently participating.

Season Timer

You can use RotationTimeLeft to display a season end timer in the UI. This allows players to know when the season will end.