Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

69
Vistas
getting only the results i need in unminable API

I wanna use unminable API like this one

 https://api.unminable.com/v4/address/0x9ee9e85cae8299f1f634d2306dbab94c885040a1?coin=SHIB

if u see when u use this URL in the browser the result is

{"success":true,"msg":"Ok","data":{"balance":"812765.88792766","balance_payable":"812765.88792766","precision":"8","payment_threshold":"1500000","mining_fee":"1","auto":false,"enabled":true,"enabled_auto_only":false,"uuid":"85c636dd-0598-46f1-b579-72b4b5c64ae2","fresh":false,"address":"0x9ee9e85cae8299f1f634d2306dbab94c885040a1","network":"ETH","err_flags":{"payment_error":false,"missing_memo":false,"not_activated":false,"restricted":false},"chains":[{"name":"Ethereum","network":"ETH","token_standard":"ERC20","regex":"^(0x)[0-9A-Fa-f]{40}$","regex_memo":null,"is_default":true,"explorer_address":"https://etherscan.io/address/","enabled":true,"enabled_auto_only":false,"payment_threshold":"1500000","compatible":true},{"name":"Binance Smart Chain","network":"BSC","token_standard":"BEP20","regex":"^(0x)[0-9A-Fa-f]{40}$","regex_memo":null,"is_default":false,"explorer_address":"https://bscscan.com/address/","enabled":true,"enabled_auto_only":false,"payment_threshold":"250000","compatible":true},{"name":"Kucoin Community Chain","network":"KCC","token_standard":"KRC20","regex":"^(0x)[0-9A-Fa-f]{40}$","regex_memo":null,"is_default":false,"explorer_address":"https://explorer.kcc.io/en/address/","enabled":true,"enabled_auto_only":false,"payment_threshold":"250000","compatible":true}]}}

but I only want to see the balance

"balance":"812765.88792766"

is there is any method to do that in HTML or Javascript WebPage? Thanks for all

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Save the result in an object, then access the data.balance property like this, and then update your html when data is fetched from the api:

Given this html:

<div id="balance"></div>
<button onclick="fetchDataAndUpdateHtml()">Click me</button>

You can fetch the data and update it like this:

function fetchDataAndUpdateHtml() {
    const url = 'https://api.unminable.com/v4/address/0x9ee9e85cae8299f1f634d2306dbab94c885040a1?coin=SHIB';
    fetch(url)
        .then(response => response.json())
        .then((result) => {
            document.getElementById('balance').innerHTML = result.data.balance));
        });

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos