Skip to main content

Data Retrieval

API for retrieving remote configuration values.

URL Confirmation

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

API Information

  • URL: https://service-api.playnanoo.com/storage/v20211101/load/public
  • Method: PUT
  • Authentication Required: Yes

Request Parameters

ParameterTypeRequiredDescription
storage_keystringRequiredRemote configuration key (RemoteConfig_{tableCode} format)
DeviceInfo Inheritance

The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.

Response Data

Res Class

FieldTypeDescription
StorageKeystringStorage key
StorageValuestringStorage value
remote_config_variablesList\<RemoteConfigVariable>List of remote configuration variables

RemoteConfigVariable Structure

FieldTypeDescription
remote_config_variable_typestringVariable type
remote_config_variable_keystringVariable key
remote_config_variable_descriptionstringVariable description
remote_config_variable_valuestringVariable value
remote_config_variable_createdAtlongCreation time

Unity C# Implementation

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

public class RemoteConfig
{
static string url = "https://service-api.playnanoo.com/storage/v20211101/load/public";

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

public IEnumerator Send(
string tableCode,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(tableCode)) this.storage_key = $"RemoteConfig_{tableCode}";

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

[Serializable]
public class Res : BaseResponse
{
public string StorageKey;
public string StorageValue;
public List<RemoteConfigVariable> remote_config_variables;
}

[Serializable]
public class RemoteConfigVariable
{
public string remote_config_variable_type;
public string remote_config_variable_key;
public string remote_config_variable_description;
public string remote_config_variable_value;
public long remote_config_variable_createdAt;
}
}

Usage Example

public void LoadRemoteConfig()
{
string tableCode = "Remote Config Table Code";

RemoteConfig.Req req = new RemoteConfig.Req();
StartCoroutine(req.Send(
tableCode: tableCode,
onSuccess: res =>
{
// No additional parsing required when using Newtonsoft.Json.
var data = JsonUtility.FromJson<RemoteConfig.Res>(res.StorageValue);
foreach (var v in data.remote_config_variables)
{
Debug.Log($"Type : [{v.remote_config_variable_type}]");
Debug.Log($"Key : [{v.remote_config_variable_key}]");
Debug.Log($"Description : [{v.remote_config_variable_description}]");
Debug.Log($"Value : [{v.remote_config_variable_value}]");
Debug.Log($"CreateAt : [{v.remote_config_variable_createdAt}]");
}
},
onError: (error) =>
{
Debug.LogError($"RemoteConfig failed: [{error.ErrorCode}] {error.Message}");
}
));
}