This article desribes the API of the STEEM full node (not of the wallet API).
Prerequisits
This article assumes that you have a full node running and listening to port 8092
, locally. You can achieve this by
./programs/steemd/steemd --rpc-endpoint=127.0.0.1:8092
We open up the RPC endpoint so that we can interface with the node using RPC-JSON calls.
Call Format
In Graphene, RPC calls are state-less and accessible via regular JSON formated RPC-HTTP-calls. The correct structure of the JSON call is
{
"jsonrpc": "2.0",
"id": 1
"method": "get_account",
"params": [["xeroc", "steemit"]],
}
The get_accounts
call is available in the full node's API and takes only one argument which is an array of account ids (here: ["xeroc", "steemit"]
).
Example Call with curl
Such as call can be submitted via curl
:
curl --data '{"jsonrpc": "2.0", "method": "get_accounts", "params": [["xeroc","steemit"]], "id": 1}' http://127.0.0.1:8090/rpc
Successful Calls
The API will return a properly JSON formated response carrying the same id
as the request to distinguish subsequent calls.
{ "id":1, "result": "data" }
Errors
In case of an error, the resulting answer will carry an error
attribute and
a detailed description:
{
"id": 0
"error": {
"data": {
"code": error-code,
"name": " .. name of exception .."
"message": " .. message of exception ..",
"stack": [ .. stack trace .. ],
},
"code": 1,
},
}
Available Calls
Even though, the help
call does not exist, it gives us an error message that contains all available API calls in the stack trace:
curl --data '{"jsonrpc": "2.0", "method": "help", "params": [], "id": 1}' http://127.0.0.1:8090/rpc
{
"id": 1,
"error": {
"message": <...>,
"data": {
"message": "Assert Exception",
"name": "assert_exception",
"stack": [
{
"data": {
"name": "help",
"api": {
"set_subscribe_callback": 0,
"get_dynamic_global_properties": 12,
"get_accounts": 17,
"get_active_categories": 9,
"get_account_references": 18,
"get_trending_categories": 7,
"get_content": 36,
"get_state": 6,
"get_discussions_by_total_pending_payout": 38,
"cancel_all_subscriptions": 3,
"get_block_header": 4,
"get_active_votes": 35,
"get_current_median_history_price": 15,
"lookup_witness_accounts": 26,
"verify_account_authority": 34,
"get_key_references": 16,
"set_pending_transaction_callback": 1,
"get_required_signatures": 31,
"get_recent_categories": 10,
"get_order_book": 28,
"lookup_accounts": 20,
"get_account_history": 23,
"get_chain_properties": 13,
"get_feed_history": 14,
"verify_authority": 33,
"get_discussions_by_last_update": 40,
"get_conversion_requests": 22,
"get_discussions_in_category_by_last_update": 41,
"get_block": 5,
"get_witness_count": 27,
"get_best_categories": 8,
"get_potential_signatures": 32,
"lookup_account_names": 19,
"get_transaction": 30,
"get_witnesses": 24,
"get_witness_by_account": 25,
"get_account_count": 21,
"get_transaction_hex": 29,
"get_content_replies": 37,
"get_discussions_in_category_by_total_pending_payout": 39,
"get_miner_queue": 43,
"get_active_witnesses": 42,
"set_block_applied_callback": 2,
"get_config": 11
}
},
"context": {
"line": 109,
"hostname": "",
"timestamp": "2016-04-13T16:15:17",
"method": "call",
"thread_name": "th_a",
"level": "error",
"file": "api_connection.hpp"
},
"format": "itr != _by_name.end(): no method with name '${name}'"
}
],
"code": 10
},
"code": 1
}
}
Further documentation about the calls can be found in the sources in libraries/app/include/steemit/app/database_api.hpp.