Developer's Hub
v1.0
GetBalance()
Summary
Route | Type | Example |
|---|---|---|
/monitor/getbalance | POST |
Description
Gets the balance of a wallet.
Request
Request Structure
{
// Parameters common for all requests
// Wallet address
"PublicKey": "public key in base 58 format",
}
Request Parameters
string: PublicKey - Wallet address (public key) in Base58
Response
JSON output depends on the request type and its success.
If there’s an error, request returns to the node basic Result:
Success: False
Message:
If successful, requested information is returned.
Response Structure
{
"cs_balance": "decimal_value", // Balance in CS
[ {
“name”: “token_name”, // Name of a token
“balance: “token_balance” // Token balance
} ],
“delegated_in”: "decimal_value",
“delegated_out”: "decimal_value"
}
Example Code
import requests
import json
def GetBalance():
url = 'http://apinode.credits.com/api/monitor/getbalance'
headers = {
'Content-type': 'application/json'
, 'Accept': 'application/json'
, 'Content-Encoding': 'utf-8'
}
data = {
"authKey": ""
, "NetworkAlias":"Mainnet"
, "PublicKey":"23Atj7oiDU8XK1Wc7rMHvFnKQM5LRpttyn4zV8rbKw83"
}
answer = requests.post(url, data=json.dumps(data), headers=headers)
response = answer.json()
print(response)
GetBalance()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Program.Getinfo
{
public class GetBalance
{
static readonly HttpClient client = new HttpClient();
public class body
{
public string authKey { get; set; }
public string networkAlias { get; set; }
public string PublicKey { get; set; }
}
public static async Task Main()
{
try
{
var body = new body
{
authKey = "",
networkAlias = "Mainnet",
PublicKey = "23Atj7oiDU8XK1Wc7rMHvFnKQM5LRpttyn4zV8rbKw83"
#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
using namespace utility; // Common utilities like string conversions
using namespace web; // Common features like URIs.
using namespace web::http; // Common HTTP functionality
using namespace web::http::client; // HTTP client features
using namespace concurrency::streams; // Asynchronous streams
using namespace web::json;
int main(int argc, char* argv[])
{
web::json::value json_v;
web::json::value json_return;
json_v[L"authKey"] = web::json::value::string(L"");
json_v[L"NetworkAlias"] = web::json::value::string(L"Testnet");
json_v[L"PublicKey"] = web::json::value::string(L"EnrT42AkUpe32xw1tXE4e3siGMExpRe7uvsgNj36RzLc");
Last updated on
Credits Protocol
Getting Started
API Reference
Developers Journal
Powered by
