GetRequest

Description

Call any API method from the MultiversX Network.

Declaration

public static void GetRequest<T>(string url, UnityAction<CompleteCallback<T>> completeMethod)

Parameters

Name
Description

T

The return type

url

Get API url

completeMethod

Complete listener

Example

To call this API method:

MultiversX API

Call the GetRequest method as shown:

public class Test : MonoBehaviour
{
    public void Get()
    {
        string url = "/accounts/erd1jza9qqw0l24svfmm2u8wj24gdf84hksd5xrctk0s0a36leyqptgs5whlhf";
        MultiversX.UnityTools.API.GetRequest<AccountDto>(url, CompleteMethodGet);
    }
    private void CompleteMethodGet(CompleteCallback<AccountDto> result)
    {
        if (result.status == OperationStatus.Success)
        {
            //display the nonce of the account
            Debug.Log(result.data.Nonce);
        }
        else
        {
            Debug.LogError(result.errorMessage);
        }
    }
}

Last updated