Skip to main content

Random User Search

Searches for random users.

URL Confirmation

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

API Information

  • URL: https://service-api.playnanoo.com/friend/v20231201/searchRandom
  • 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
table_codestringRequiredFriend table code
limitintRequiredNumber of users to search

Response Data

Res Class

FieldTypeDescription
ItemsList<ItemModel>Random user list

ItemModel Class

FieldTypeDescription
OpenIdstringOpen ID
UserIdstringUser ID
NicknamestringNickname
AccessSecondsintLast access time (in seconds)
InDatestringRegistration date

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 account is in withdrawal grace period (provided only for accounts in withdrawal grace period)
  • BlockKey: Key provided if account is blocked (provided only for blocked accounts)

Random User Search Class

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

public class FriendRandomSearch
{
static string path = "https://service-api.playnanoo.com/friend/v20231201/searchRandom";

[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public int limit;

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

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

[Serializable]
public class Res : BaseResponse
{
public List<ItemModel> Items = new List<ItemModel>();
}

[Serializable]
public class ItemModel
{
public string OpenId;
public string UserId;
public string Nickname;
public int AccessSeconds;
public string InDate;
}
}

Usage Example

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
void SearchRandomUsers()
{
FriendRandomSearch.Req req = new FriendRandomSearch.Req();

StartCoroutine(req.Send(
tableCode: "friend_table",
limit: 10,
onSuccess: res =>
{
Debug.Log($"Found {res.Items.Count} random users");

foreach (var user in res.Items)
{
Debug.Log($"User: {user.Nickname} (ID: {user.UserId})");
Debug.Log($" OpenId: {user.OpenId}");
Debug.Log($" Registration Date: {user.InDate}");
}
},
onError: (error) =>
{
Debug.LogError($"Random user search failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}
}
Friend Recommendations

You can use this API to implement a "suggested friends" feature. You can send friend requests to the searched users.