Developers
  • SWT PROTOCOL
    • Introduction
    • Accounts
    • Transactions
    • Fees
    • Smart Contracts
  • GETTING STARTED
    • Network Node
      • Introduction
      • STEP 1:RENTING A LINUX VPS
      • STEP 2:INSTALLATION OF PUTTY
      • STEP 3:INSTALLATION OF FILEZILLA
      • STEP 4:VPS CONNECTION AND LINUX CONFIGURATION WITH PUTTY (SSH)
      • STEP 5:HOW TO SECURE YOUR VPS
      • STEP 6:USING TMUX THROUGH PUTTY
      • STEP 7:UPLOAD OF THE SWT SOFTWARE WITH FILEZILLA
      • STEP 8:EXTRACT THE SWT SOFTWARE FOLDER
      • STEP 9:RUNNING THE SWT NODE THROUGH TMUX
      • STEP 10:RUNNING THE MONITORING TOOLS
  • API REFERENCE
    • Apache Thrift API
      • Transactions
      • Blocks
      • Smart contract
      • Tokens
      • Wallets
      • Sync info
      • Data structures
    • REST API
      • GetBlocks()
      • GetNodeInfo()
      • GetBalance()
      • GetWalletInfo()
      • GetTokenBalance()
      • GetTransactionsByWallet()
      • GetTransactionInfo()
      • GetEstimatedFee()
      • GetContractByAddress()
      • GetContractFromTransaction()
      • GetContractMethods()
      • ContractValidation()
      • ContractCall()
      • TransactionPack()
      • TransactionExec()
  • SMART CONTRACTS
    • Creating "Hello-world" Smart Contract
    • Smart Contract Methods
    • Smart Contract Standarts
      • Token Smart Contract
      • Escrow Smart Contract
      • Stable coin Token
  • HOW TO REST API
    • Introduction
    • Retrieve a balance from the blockchain
    • Request a specific transaction from the blockchain
    • Sending Transactions to the SWT Blockchain
    • Validating and deploying a Smart Contract with REST API
Powered by GitBook
On this page
  • General Rules
  • Basic URL
  • Request
  • Example Request Structure
  • Parameter Information
  • Example Response
  • API Methods
  1. API REFERENCE

REST API

PreviousData structuresNextGetBlocks()

Last updated 1 year ago

The REST API is the interface that you can use to talk to the Smart Wallet Token(SWT) blockchain and develop smart contracts.

General Rules

Basic URL

To access the public REST platform SWT you should use basic URL:

To specify the request, you need to add a specific route to the base URL. Specific routes are indicated for each REST API method in "Summary" paragraph, full URLs are given there as an example of public REST.

Request

Each request includes parameters, structured as a JSON data object, that follows the standard REST API rules.

In addition to those parameters, specific parameters are usually used depending on a particular request. These parameters vary for each request, and are described in the corresponding sections.

Example Request Structure

{

"authKey": "guid",

"networkAlias":"text",

"networkIp": "ip v4 address",

"networkPort": u16_value

}

Parameter Information

guid: authKey: unique identifier(token) of a client, obtained via registration

string: networkAlias: name of the network. there are two possible names at the moment: MainNet and TestNet

string: networkIp: IP address of the requested node

string: networkPort: port open for requests on the node

Parameters networkAlias and the pair networkIp, networkPort are mutually exclusive. It’s recommended to always use the first option, and use the second one only when you need to explicitly indicate the requested node. If both options are specified, networkAlias has a higher priority. Specifying one of the 2 parameters is mandatory.

Example Response

The response includes its own set of elements. However, if there’s an error during request execution, the response always has the following structure:

{

	// Error indicator

	“Success”: false,

	// Error description

	“Message”: “text”

}

API Methods

GetBlocks()

GetNodeInfo()

GetBalance()

GetWalletInfo()

GetTokenBalance()

GetTransactionsByWallet()

GetTransactionInfo()

GetContractByAddress()

GetContractFromTransaction()

GetContractMethods()

ContractValidation()

ContractCall()

TransactionPack()

TransactionExec()

http://176.113.80.7:62000/api