Skip to main content

How to call API

Making API calls to the Zano Daemon and Wallet is easy, below we'll give you an example to help you get started building on Zano.

Using Insomnia

Insomnia is a program (similar to postman) that helps you design, debug, and test APIs, heres an example API call to the Zano Daemon using Insomnia.


Using NodeJS

Below is an example of the same API call using NodeJS:

const axios = require("axios");

async function callAPI() {
try {
const url = "http://127.0.0.1:11211/json_rpc";
const requestData = {
jsonrpc: "2.0",
id: 0,
method: "getbalance",
};

const response = await axios.post(url, requestData);
console.log(response.data);
// Process the response data as needed
} catch (error) {
console.error("Error:", error.message);
}
}

callAPI();

Summary

When running the Daemon and Wallet in RPC mode locally, the following URL, whether using something like Insomnia or NodeJS or some other language, you access the daemon with the following URL:

http://127.0.0.1:11211/json_rpc

Have fun building on Zano!