api_system - UCHAIN-WORLD/uchain-fullnode GitHub Wiki

title: system api

API list

  • help

    show command usage.

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "{COMMAND}",  
        "params": [ "test", "123456"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response (Example for shutdown)

    {
    "id": 7,
    "jsonrpc": "3.0",
    "result": "\nUsage: uc-cli shutdown [-h] [ADMINNAME] [ADMINAUTH]                      \n\n
    Info: stop ucd.                                                          \n\n
    Options (named):\n\n-h [--help]          Get a description and instructions for this command.\n\n
    Arguments (positional):\n\n
    ADMINNAME            admin name.                                         \n
    ADMINAUTH            admin password/authorization.                       \n"
    

}


  • shutdown

    stop ucd.

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "shutdown",  
        "params": [ "test", "123456"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response

    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : "sending SIGTERM to ucd."
    }
    
    
    

  • showinfo

    display infomation of the blockchain.

    • JS Parameters
    { 
      method: 'POST',  
      url: 'http://127.0.0.1:8707/rpc/v3',  
      headers:   
      {  
       'Content-Type': 'application/json'   
      },  
      body: 
    { 
         "jsonrpc":"3.0",  
         "method":"showinfo",  
         "params":[ "test", "123456" ],  
          "id":7   
         },
      json: true   
    };
    
    • Response
       {
    	"id" : 7,
    	"jsonrpc" : "3.0",
    	"result" : 
    	{
    		"database_version" : "0.0.2",
    		"height" : 383975,
    		"is_mining" : false,
    		"miner-count" : 3,
    		"peers" : 0,
    		"protocol_version" : 70012,
    		"token_count" : 2,
    		"wallet_wallet_count" : 10,
    		"wallet_version" : "0.0.2"
    	}
    }
    
    

  • addpeer

    This command is used to add/remove p2p node.

    • JS Parameters
        { 
            method: 'POST',  
            url: 'http://127.0.0.1:8707/rpc/v3',  
            headers:   
            {  
             'Content-Type': 'application/json'   
            },  
            body: 
              { 
                       "jsonrpc": "3.0",  
                        "method": "addpeer",  
                        "params": ["192.168.16.169", "5682"],  
                        "id": 7   
                        },  
            json: true   
         };
      
      • Response
    {
    	"id" : 7,
    	"jsonrpc" : "3.0",
    	"result" : "success"
    }
    
    

  • showpeers

    list peers already added

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
          { 
                  { 
                          "jsonrpc": "3.0",  
                          "method": "showpeers"
                          " params": ["192.168.16.169", "5682"],  
                   "id": 4   
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 4,
    "jsonrpc" : "3.0",
    "result" : 
    [
    	"192.168.16.211:5682",
    	"116.62.238.230:5682",
    	"112.74.181.29:5682",
    	"192.168.16.212:5682",
    	"13.124.250.27:5682",
    	"192.168.16.128:5682",
    	"35.182.225.90:5682",
    	"192.168.16.249:5682",
    	"192.168.16.249:58322"
    ]
    }