Skip to main content

Multi Load Data

API for loading multiple saved data items at once.

URL Verification

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

API Information

  • URL: https://service-storage-api.playnanoo.com/storage/v20221001/load/multi
  • 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
storage_keysstring[]RequiredList of data keys to load

Response Data

Res Class

FieldTypeDescription
ItemsStorageItem[]List of loaded data

StorageItem Structure

FieldTypeDescription
PlayerIdstringPlayer ID
StorageKeystringKey of the data
StorageValuestringValue of the data

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)

Multi Load Data Class

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

public class StorageMultiLoad
{
static string path = "https://service-storage-api.playnanoo.com/storage/v20221001/load/multi";

[Serializable]
public class StorageItem
{
public string PlayerId;
public string StorageKey;
public string StorageValue;
}

[Serializable]
public class Req : DeviceInfo
{
public string[] storage_keys; // List of data keys to load

public IEnumerator Send(string[] storage_keys, Action<Res> onSuccess, Action<BaseResponse> onError)
{
this.storage_keys = storage_keys;

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

[Serializable]
public class Res : BaseResponse
{
public StorageItem[] Items;
}
}

Usage Example

public void LoadMultipleData()
{
StorageMultiLoad.Req req = new StorageMultiLoad.Req();

// List of data keys to load
string[] keys = new string[]
{
"player_level",
"player_gold",
"player_inventory"
};

StartCoroutine(req.Send(
storage_keys: keys,
onSuccess: res =>
{
Debug.Log("Multi data loading successful");

foreach (var item in res.Items)
{
Debug.Log($"Player ID: {item.PlayerId}");
Debug.Log($"{item.StorageKey}: {item.StorageValue}");
}
},
onError: error =>
{
Debug.LogError($"Multi data loading failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Efficient Loading

When you need to load multiple data items simultaneously, using this API can reduce the number of network requests, making it more efficient.

Non-existent Keys

No error occurs even if some of the requested keys do not exist, and only existing data is returned.