RESTful API v2
Weaver
All functions provided, including authentication, ecosystem data reception, error handling, database table manipulation, page and contract execution are available through
IBAX Blockchain Platform's REST API is available.
By using the REST API, developers can access any of the platform's features without using Weaver.
API command calls are executed by addressing /api/v2/command/[param]
, where command
is the command name and param
is the additional parameter. The request parameters must be specified using the
Content-Type: x-www-form-urlencoded
The format is sent. The server response result is in JSON format.
Error response handling
Return status in case of successful request execution 200
. If an error occurs, in addition to the error status, a JSON object with the following fields will be returned.
error
Error identifier.
msg
Error text message.
params
An array of additional parameters that can be placed in the error message.
Response Example
Error list
E_CONTRACT
E_DBNIL
E_DELETEDKEY
E_ECOSYSTEM
E_EMPTYPUBLIC
E_KEYNOTFOUND
E_HASHWRONG
E_HASHNOTFOUND
E_HEAVYPAGE
E_INVALIDWALLET
E_LIMITTXSIZE
E_NOTFOUND
E_PARAMNOTFOUND
E_PERMISSION
E_QUERY
E_RECOVERED
E_SERVER
E_SIGNATURE
E_STATELOGIN
E_TABLENOTFOUND
E_TOKENEXPIRED
E_UNAUTHORIZED
E_UNKNOWNUID
E_UPDATING
E_STOPPING
E_NOTIMPLEMENTED
E_BANNED
E_CHECKROLE
Interface requests for which the CLB node is not available.
- metrics
- txinfo
- txinfoMultiple
- appparam
- appparams
- appcontent
- history
- balance
- block
- maxblockid
- blocks
- detailed_blocks
- ecosystemparams
- systemparams
- ecosystems
- ecosystemparam
- ecosystemname
- walletHistory
- tx_record
Request Type
Uniform use
- application/x-www-form-urlencoded
Authentication Interface
JWT token (opens new window)
Used for authentication. The JWT token must be placed in each request header after it is received: Authorization: Bearer TOKEN_HERE
.
getuid
GET/ returns a unique value, signs it with the private key, and then uses.
The login command sends it back to the server.
Generate a temporary JWT token that needs to be passed to Authorization when calling login.
Request
Response
uid
Signature number.
token
The temporary token passed during login.
The life cycle of a temporary token is 5 seconds.
network_id
Server identifier.
cryptoer
Elliptic curve algorithm.
hasher
hash algorithm.
Response Example 1
In the case that no authorization is required (the request contains Authorization), the following message will be returned:
expire
Expiration time.
ecosystem
Ecosystem ID.
key_id
Account address.
address
Wallet address XXXX-XXXX-..... -XXXX
.
network_id
Server identifier.
Response Example 2
Error Response
E_SERVER
login
POST/ User authentication.
getuid should be called first command in order to receive the unique value and sign it. getuid's temporary JWT token needs to be passed in the request header.
If the request is successful, the token received in the response is contained in Authorization.
Request
ecosystem
Ecosystem ID.
If not specified, defaults to the first ecosystem ID.
expire
Lifecycle of the JWT token, in seconds, default is 28800.
pubkey
Hexadecimal account public key.
key_id
Account address XXXX-... -XXXX
.
Use this parameter if the public key is already stored in the blockchain. It cannot be used with pubkey parameters are used together.
signature
The uid signature received via getuid.
Response
token
JWT token.
ecosystem_id
Ecosystem ID.
key_id
Account Address ID
account
Wallet address XXXX-XXXX-..... -XXXX
.
notify_key
Notification ID.
isnode
Whether the account address is the owner of the node. Values: true,false
.
isowner
Whether the account address is the creator of the ecosystem. Values: true,false
.
clb
Whether the logged-in ecosystem is CLB. Values: true,false
.
roles
Omitempty
Role list: [{Role ID,Role Name}]
.
Response Example
Error Response
E_SERVER, E_UNKNOWNUID, E_SIGNATURE, E_STATELOGIN, E_EMPTYPUBLIC
Server Side command interface
version
GET/ Returns the current server version.
This request does not require login authorization.
Request
Response Example
Data Request Function Interface
balance
GET/ Requests the balance of the account address in the current ecosystem.
This request does not require login authorization.
Request
Response
amount
The minimum unit of contract account balance.
money
Account balance.
total
Account balance.
utxo
UTXO account balance.
digits
precision.
Response Example
Error Response
E_SERVER, E_INVALIDWALLET
blocks
GET/ Returns a list containing additional information related to the transactions in each block.
This request does not require login authorization.
Request
Response
Block height
List of transactions in the block and additional information for each transaction.
Trading Hash.
Contract name.
Array of contract parameters.
For the first block, it is the account address of the first block that signed the transaction.
For all other blocks, is the address of the account that signed the transaction.
Response Example
Error Response
E_SERVER, E_NOTFOUND
detailed_blocks
GET/ Returns a list containing detailed additional information about the transactions in each block.
This request does not require login authorization.
Request
Response
Block height
The block height.
blockhead
The block header contains the following fields.
block_id
Block height. time
Block generation timestamp. key_id
Sign the account address for the block. node_position
The location of the node that generated the block in the honor node list. version
Block structure version.
hash
Block Hashing. node_position
the location of the node that generated the block in the honor node list. key_id
The address of the account that signed the block. time
Block generation timestamp. tx_count
Number of transactions within the block. size
The block size. rollback_hash
Block rollback hash. merkle_root
The block deals with the Merkle tree. bin_data
Serialization of the block header, all transactions within the block, the previous block hash, and the private key of the node that generated the block. transactions
List of transactions in the block and additional information about each transaction.
hash
Trading hash. contract_name
Contract name. params
Contract parameters. key_id
Sign the account address for this transaction. time
Transaction generation timestamp. type
Transaction type. size
Trade Size.
Response Example
Error Response
E_SERVER, E_NOTFOUND
/data/{id}/data/{hash}
GET/ If the specified hash matching the data in the binary watch, field, and records, this request will return the data. Otherwise, return error.
The request does not require login authorization.
Request
id
Record ID.
hash
Hash request data.
Response
Binary data
Response Example
Error Response
E_SERVER, E_NOTFOUND, E_HASHWRONG
/data/{table}/id/{column}/{hash}
GET/ If the specified hash matches the data in the specified table, field, and records, the request will return the data. Otherwise, return error.
The request does not require login authorization.
Request
table
Data table name.
id
Record ID.
column
Data table name, only one
hash
Hash request data.
Response
Binary data
Response Example
Error Response
E_SERVER, E_NOTFOUND, E_HASHWRONG
keyinfo
GET/ Return to a list of ecosystems, which contains the role of registered the specified address.
The request does not require login authorization.
Request
address
Address identifier, you can specify int64, uint64, xxxx -...-xxxx
.
This request is query in all ecosystems.
Response
ecosystem
Ecosystem ID.
name
Ecosystem name.
roles
Activities with id and name fields.
Response Example
Error Response
E_SERVER, E_INVALIDWALLET
walletHistory
GET/ Return to the current account transaction history record, find it according to the ID of the ID.
Authorization
Request
searchType
Find Type (Income: Turn into Outcom: Turn out all: All, default).
page
Omitempty
Find the number of pages, the first page default, min: 1
limit
Omitempty
Credit number, default 20 articles. min: 1, MAX: 500
Response
Response Example
Error Response
E_SERVER
listWhere/{name}
GET/ Return to the entry of the data table specified in the current ecosystem. You can specify columns to be returned.
Authorization
Request
name
Data table name.
limit
Omitempty
Credit number, default 25.
offset
Omitempty
Disposal, default to 0.
order
Omitempty
Sorting method, default id ASC
.
columns
Omitempty
The list of request columns is separated by commas. If it is not specified, all columns will be returned. In all cases, the id
column will be returned.
where
Omitempty
Query condition
Example: If you want to query id> 2 and name = john
You can use: where: {"id": {"$ gt": 2}, "name": {"$eq": "john"}}
For details, please refer to [DBFind](../ topics/script.md#dbfind) where syntax
Response
count
Total number of entries.
list
Each element in the array contains the following parameters:
id
Stripe ID.
...
Data tables other columns
Response Example
Error Response
E_SERVER,E_TABLENOTFOUND
nodelistWhere/{name}
GET/ Return to the specified data table. You can specify columns to be returned. The type in the data table is BYTEA Do hexadecimal encoding processing
Authorization
Request
name
Data table name.
limit
Omitempty
Credit number, default 25.
offset
Omitempty
Disposal, default to 0.
order
Omitempty
Sorting method, default id ASC
.
columns
Omitempty
The list of request columns is separated by commas. If it is not specified, all columns will be returned. In all cases, the id
column will be returned.
where
Omitempty
Query condition
Example: If you want to query id> 2 and name = john
You can use: where: {"id": {"$ gt": 2}, "name": {"$eq": "john"}}
For details, please refer to [DBFind](../ topics/script.md#dbfind) where syntax
Response
count
Total number of entries.
list
Each element in the array contains the following parameters:
id
Stripe ID.
...
Data tables other columns
Response Example
Error Response
E_SERVER,E_TABLENOTFOUND
Get Metrics Interface
metrics/keys
GET/ Returns the number of ecosystem 1 account addresses.
Request
Response Example
metrics/blocks
GET/ Returns the number of blocks.
Request
Response Example
metrics/transactions
GET/ Returns the total number of transactions.
Request
Response Example
metrics/ecosystems
GET/ Returns the number of ecosystems.
Request
Response Example
metrics/honornodes
GET/ Returns the number of honor nodes.
This request does not require login authorization.
Response Example
Ecosystem Interface
ecosystemname
GET/ Returns the name of the ecosystem by its identifier.
This request does not require login authorization.
Response Example
Error Response
E_PARAMNOTFOUND
appparams/{appid}
Authorization
GET/ Returns a list of application parameters in the current or specified ecosystem.
Request
appid
Application ID.
ecosystem
Ecosystem ID; if not specified, the current ecosystem parameter will be returned.
names
The list of received parameters.
You can specify a comma-separated list of parameter names, for example: /api/v2/appparams/1?names=name,mypar
.
Response
list
Each element of the array contains the following parameters.
name
, the name of the parameter. value
, the value of the parameter. conditions
, change the permissions of the parameters.
Response Example
Error Response
E_ECOSYSTEM
appparam/{appid}/{name}
Authorization
GET/ Returns information about the parameter {name} of the application {appid} in the current or specified ecosystem.
Request
appid
Application ID.
name
The name of the requested parameter.
ecosystem
Omitempty
Ecosystem ID (optional parameter).
Returns the current ecosystem by default.
Response
id
Parameter ID.
name
Parameter name.
value
The parameter value.
conditions
Permission to change parameters.
Response Example
Error Response
E_ECOSYSTEM, E_PARAMNOTFOUND
ecosystemparams
Authorization
GET/ Returns a list of ecosystem parameters.
Request
ecosystem
Omitempty
Ecosystem ID. if not specified, the current ecosystem ID will be returned.
names
Omitempty
List of request parameters, separated by commas.
For example: /api/v2/ecosystemparams/?names=name,currency,logo
.
Response
list
Each element of the array contains the following parameters.
Parameter name.
Parameter value.
Change permissions for parameters.
Response Example
Error Response
E_ECOSYSTEM
ecosystemparam/{name}
Authorization
GET/ Returns information about the parameter {name} in the current or specified ecosystem.
Request
name
The name of the requested parameter.
ecosystem
Omitempty
The default is to return the current ecosystem ID.
Response
name
Parameter name.
value
The parameter value.
conditions
Permission to change parameters.
Response Example
Error Response
E_ECOSYSTEM
tables/[?limit=... &offset=... ]
Authorization
GET/ Returns a list of data tables for the current ecosystem. You can set the offset and the number of entries.
Request
limit
Omitempty
Number of entries, default 100, maximum 1000.
offset
Omitempty
Offset, default is 0.
Response
count
The total number of entries in the data table.
list
Each element of the array contains the following parameters.
Data table name without prefix.
The number of entries in the data table.
Response Example
table/{name}
Authorization
GET/ Returns information about the current ecosystem request data table.
Request
Returns the following field information.
name
Data table name.
insert
Permission to add new entries.
new_column
Add field permissions.
update
Change entry permissions.
columns
Array of field-related information.
Field name.
Field data type.
Change the permissions for the field value.
list/{name}[?limit=... &offset=... &columns=... ]
Authorization
GET/
Returns a list of the specified data table entries in the current ecosystem. You can set the offset and the number of entries.
Request
name
Data table name.
limit
Omitempty
Number of entries, default 25 entries.
offset
Omitempty
Offset, default is 0.
columns
Omitempty
A comma-separated list of requested columns, if not specified, all columns will be returned. The id column will be returned in all cases.
Response
count
Total number of entries.
list
Each element of the array contains the following parameters.
Entry ID.
- The sequence of request columns.
Response Example
sections[?limit=... &offset=... &lang=]
Authorization
GET/ Returns a list of entries in the sections table of the current ecosystem, with the ability to set an offset and number of entries.
If the role_access field contains a list of roles and does not include the current role, no records will be returned. The data in the title field will be replaced with the language resource specified in the request header Accept-Language.
Request
limit
Omitempty
Number of entries, default 25 entries.
offset
Omitempty
Offset, default is 0.
lang
Omitempty
This field specifies the multilingual resource code or localization, e.g., en, de. If the specified language resource is not found, e.g., en-US, it will search within the language resource group en.
Response
count
sections Total number of table entries.
list
Each element of the array contains information about all columns in the actions table.
Response Example
Error Response
E_TABLENOTFOUND
row/{name}/{id}[?columns=]
Authorization
GET/ Returns the entry for the specified data table in the current ecosystem. You can specify the columns to be returned.
Request
name
Data table name.
id
Entry ID.
columns
Omitempty
A comma-separated list of requested columns, if not specified, all columns will be returned. The id column will be returned in all cases.
Response
value
Array of received column values
Entry ID.
- The sequence of request columns.
Response Example
Error Response
E_NOTFOUND
row/{name}/{column}/{id}
[Authorization] (#authorization)
GET/ Return to the entry of the data table specified in the current ecosystem. You can specify columns to be returned.
Request
Response
value
Array of receiving column values
Forecast
Strip ID.
- -The sequence of the request column.
Response Example
Error Response
E_NOTFOUND
systemparams
Authorization
GET/ Returns a list of platform parameters.
Request
Response
list
Each element of the array contains the following parameters.
Parameter name.
Parameter values.
Change the permission of the parameter.
Response Example
Error Response
E_PARAMNOTFOUND
history/{name}/{id}
Authorization
GET/ Returns the change record for the entry in the specified data table in the current ecosystem.
Request
Data Table Name.
Entry ID.
Response
Each element of the array contains a change record for the requested entry.
Response Example
Authorization
GET/ Returns the entry for the name field in the specified data table (pages, menu or snippet) for the current ecosystem.
Request
name
Specifies the name of the entry in the table.
Response
id
Entry ID.
name
Entry name.
other
Other columns of the table.
Response Example
Error Response
E_QUERY, E_NOTFOUND
Contract Function Interface
contracts[?limit=... &offset=... ]
Authorization
GET/ Returns a list of contracts in the current ecosystem, with the ability to set offsets and the number of entries.
Request
limit
Omitempty
Number of entries, default 25 entries.
offset
Omitempty
Offset, default is 0.
Response
count
Total number of entries.
list
Each element of the array contains the following parameters.
Contract ID.
Contract name.
Contract contents.
The account address to which the contract is tied.
Contract-bound wallet address XXXX-... -XXXX
.
The ecosystem ID to which the contract belongs.
The application ID to which the contract belongs.
Change the permission of the contract.
The ID of the ecosystem where the pass is used to pay the contract fee.
Response Example
contract/{name}
Authorization
GET/ Returns information about the specified contract. The default is to query the contract in the current ecosystem.
Request
Response
Response Example
Error Response
E_CONTRACT
sendTX
Authorization
POST/
Receives the transactions in the parameters and adds them to the transaction queue, returning a transaction hash if the request is executed successfully. This hash yields the corresponding transaction within the block and is included in the error text message in case of an Error Response.
Request
tx_key
Transaction content, this parameter can specify any name and supports receiving multiple transactions.
Response
hashes
Transaction hash arrays.
Trading 1 hash.
Trading N's hash.
Response Example
Error Response
E_LIMITTXSIZE,E_BANNED
txstatus
Authorization
POST/
Returns the block ID and error message for the specified transaction hash. If the return values for the block ID and error text message are null, then the transaction is not yet contained in the block.
Request
data
JSON list of transaction hashes.
Response
results
The transaction hash is used as the key and the transaction detail is used as the value in the data dictionary.
hash
Trading Hash.
blockid
If the transaction is executed successfully, the block ID will be returned. If the transaction fails, the blockid will be [0]{.title-ref}.
result
Returns the result of the transaction via the $result variable.
errmsg
Returns an error text message if the execution of the transaction fails.
Response Example
Error Response
E_HASHWRONG, E_HASHNOTFOUND
txinfo/{hash}
This request does not require login authorization.
GET/
Returns information about the transaction for the specified hash, including the block ID and the number of confirmations. Also returns the contract name and its associated parameters, if optional parameters are specified.
Request
hash
Transaction hash.
contractinfo
Omitempty
Contract detail parameter identifier, to get the contract details related to this transaction, specify contractinfo=1
.
Response
blockid
If the value is 0
, then no transaction was found for that hash.
confirm
The number of acknowledgements for this block blockid.
data
Omitempty
If contentinfo=1
is specified, the contract details are returned to this parameter.
Response Example
Error Response
E_HASHWRONG
txinfoMultiple
This request does not require login authorization.
GET/
Returns the transaction-related information for the specified hash.
Request
data
A list of transaction hashes.
contractinfo
Omitempty
Contract detail parameter identifier, to get the contract details related to this transaction, specify contractinfo=1
.
Response
results
The transaction hash is used as the key and the transaction detail is used as the value in the data dictionary.
hash
Trading Hash.
blockid
If the value is 0
, then no transaction was found for that hash.
confirm
Number of acknowledgements for this block blockid.
data
If contentinfo=1
is specified, the contract details are returned to this parameter.
Response Example
Error Response
E_HASHWRONG
/page/validators_count/{name}
This request does not require login authorization.
GET
Returns the number of nodes to be validated for the specified page.
Request
name
Page name with ecosystem ID in the format @ecosystem_id%%page_name%
, for example
@1main_page
.
If you don't have an ecosystem ID, then search in the first ecosystem page by default
Response
validate_count
Specifies the number of nodes to be validated for the page.
Response Example
Error Response
E_NOTFOUND, E_SERVER
Authorization
POST
Returns a tree of code JSON objects for the specified page or menu name, which is the result of processing by the template engine.
Request
name
Page name or menu name with ecosystem ID in the format @ecosystem_id%%page_name%
, for example:
@1main_page
.
If no ecosystem ID is included, then search for the current ecosystem page or menu by default.
Response
Response Example
Error Response
E_NOTFOUND
content/source/{name}
Authorization
POST
Returns a tree of coded JSON objects for the specified page name. Does not execute any functions or receive any data. The returned JSON object tree corresponds to the page template and can be used in the visual page designer. If the page is not found, a 404 error is returned.
Request
name
Page name with ecosystem ID in the format @ecosystem_id%%page_name%
, for example:
@1main_page
.
If no ecosystem ID is included, then search for the current eco-page by default.
Response
tree
JSON object tree of the page.
Response Example
Error Response
E_NOTFOUND, E_SERVER
content/hash/{name}
POST
Returns a SHA256 hash of the specified page name, or a 404 error if the page cannot be found.
This request does not require login authorization. To receive the correct hash when making requests to other nodes, you must also pass ecosystem,keyID,roleID,isMobile parameter. To receive pages from other ecosystems, the ecosystem ID must be prefixed to the page name. For example: @2mypage
.
Request
name
The name of the page with the ecosystem ID.
ecosystem
Ecosystem ID.
keyID
Account address.
roleID
Role ID.
Response
Response Example
Error Response
E_NOTFOUND, E_SERVER, E_HEAVYPAGE
content
POST
Returns the number of JSON objects for the page code from the template parameter, if the optional parameter source is specified as true or 1
, then this JSON object tree does not perform any functions and receive data.
This JSON object tree can be used in the visual page designer.
This request does not require login authorization.
Request
template
Page code.
source
If true or 1
is specified, the JSON object tree does not perform any functions and receives data.
Response
Response Example
Error Response
E_NOTFOUND, E_SERVER
maxblockid
GET/ Returns the highest block ID on the current node.
This request does not require login authorization.
Request
Response
max_block_id
The highest block ID on the current node.
Response Example
Error Response
E_NOTFOUND
block/{id}
GET/ Returns information about the specified block ID.
This request does not require login authorization.
Request
Response
hash
Block hash.
key_id
The address of the account that signed the block.
time
Block generation timestamp.
tx_count
Total number of transactions in the block.
rollbacks_hash
Block rollback hash.
node_position
The position of the block in the honor node list.
Response Example
Error Response
E_NOTFOUND
avatar/{ecosystem}/{member}
GET/ Returns the avatar of the user in the member table (available without login).
Request
ecosystem
Ecosystem ID.
member
The user's account address. (xxxx-... -xxxx)
Response
The request header Content-Type is the image type and the image data is returned in the response body.
Response Example
Error Response
E_NOTFOUND E_SERVER
config/centrifugo
GET/ Returns the host address and port of centrifugo.
This request does not require login authorization.
Request
Response
Response result format http://address:port
, e.g.: http://127.0.0.1:8100
.
Error Response
E_SERVER
updnotificator
POST/
(Discarded)
Sends all messages that have not yet been sent to the centrifugo notification service. Sends only messages for the specified ecosystem and members.
This request does not require login authorization.
Request
id
Member's account address.
ecosystem
Ecosystem ID.
Response Example
Special instructions
Omitempty
If the field has an omitempty attribute, it means that the field is an optional parameter
Authorization
If the interface has an Authorization tag, it means that this interface requires login authorization. Please add the Authorization to the request header. Here is an example:
key = Authorization
value = "Bearer + login token"