create account

Steem API by xeroc

View this thread on: hive.blogpeakd.comecency.com
· @xeroc ·
$2.66
Steem API
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

```json
{
    "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``:

```sh
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.

```json
{ "id":1, "result": "data" }
```

## Errors

In case of an error, the resulting answer will carry an ``error`` attribute and
a detailed description:

```json
{
  "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
```
```json
{
  "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](https://github.com/steemit/steem/blob/master/libraries/app/include/steemit/app/database_api.hpp).
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
πŸ‘Ž  ,
properties (23)
authorxeroc
permlinksteem-api
categoryundefined
json_metadata{}
created2016-04-13 16:25:15
last_update2016-04-13 16:25:15
depth0
children7
last_payout2016-08-24 05:37:24
cashout_time1969-12-31 23:59:59
total_payout_value2.165 HBD
curator_payout_value0.493 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,602
author_reputation118,819,064,085,695
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id130
net_rshares9,119,547,146,105
author_curate_reward""
vote details (46)
@auxon ·
"method": "get_account" should be "method": "get_accounts"  ... thanks for the post!
πŸ‘  ,
πŸ‘Ž  
properties (23)
authorauxon
permlinkre-xeroc-steem-api-20160721t173402486z
categoryundefined
json_metadata{}
created2016-07-21 17:34:03
last_update2016-07-21 17:34:03
depth1
children0
last_payout2016-08-24 05:37:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length84
author_reputation585,484,586,007
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id252,816
net_rshares30,653,584,379
author_curate_reward""
vote details (3)
@marcelhattingh ·
$0.03
@xeroc Hallo, thanks a lot for the post! I'm pretty new to Steemit and Python coding, but I have managed to successfully run some API's off other websites in the past. At the start, where you say "./programs/steemd/steemd --rpc-endpoint=127.0.0.1:8092" can be used to open a RPC endpoint. Do I run that in my CMD? I'm pretty lost. All I basically want is to run script in python, to just print a live list of the activity on the Steemit block chain. Something very similar to http://steemstream.com/ but only in my python window. Please help!
πŸ‘  , ,
πŸ‘Ž  
properties (23)
authormarcelhattingh
permlinkre-xeroc-steem-api-20160714t113339648z
categoryundefined
json_metadata{"users":["xeroc"],"links":["http://steemstream.com/"]}
created2016-07-14 11:33:39
last_update2016-07-14 11:33:39
depth1
children2
last_payout2016-08-24 05:37:24
cashout_time1969-12-31 23:59:59
total_payout_value0.025 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length542
author_reputation557,841,623,208
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id108,907
net_rshares13,980,847,140
author_curate_reward""
vote details (4)
@jl777 · (edited)
$0.03
probably need to get each block as it comes in and display what each block has:

curl http://127.0.0.1:8090": "2.0", "method": "call", "params": ["database_api", "get_block", [10000]], "id": 3}'
returns:
{"id":3,"result":{"previous":"0000270f17162d089d8cbf634b7ce434df782c9c","timestamp":"2016-03-25T00:34:48","witness":"itsascam","transaction_merkle_root":"340b3605652c91cd41456656c1915a7b5b46dffa","extensions":[],"witness_signature":"20546ff92d26a7d3ba3e3331a95c6389c9018620f9430fdee8857e925bf7fa13806dbadd7371a244706ba3df0e1ffb0db084aa4019950594d6289a11f4256b66b8","transactions":[{"ref_block_num":9999,"ref_block_prefix":137172503,"expiration":"2016-03-25T01:34:45","operations":[["pow",{"worker_account":"steemit59","block_id":"0000270f17162d089d8cbf634b7ce434df782c9c","nonce":"2069557240858032527","work":{"worker":"STM65wH1LZ7BfSHcK69SShnqCAH5xdoSZpGkUjmzHJ5GCuxEK9V5G","input":"1125c3ab09a55396c55ed60283cd6634d455d7bc1b9efb169952c654923e9f7e","signature":"20194bba7b31c53f7bc74efd9d0524e71ae87e4b60072313d866dac4c722c30da8365c3c28c972f8b06892cf1c60703d4abf550c24f66098e57a7f9671b41caf42","work":"0000000435a0bfad8471034a209d7556b4c16d77b22a66970de224f6fedad95a"},"props":{"account_creation_fee":"100.000 STEEM","maximum_block_size":131072,"sbd_interest_rate":1000}}]],"extensions":[],"signatures":[]}]}}

So you would need a loop that checks for the latest blocknumber and then iterate until you reach that number, then for each block call a parsing function, extracting the info you want to display
πŸ‘  , , ,
πŸ‘Ž  
properties (23)
authorjl777
permlinkre-marcelhattingh-re-xeroc-steem-api-20160717t112759269z
categoryundefined
json_metadata{"links":["http://127.0.0.1:8090"]}
created2016-07-17 11:28:00
last_update2016-07-17 11:33:45
depth2
children0
last_payout2016-08-24 05:37:24
cashout_time1969-12-31 23:59:59
total_payout_value0.025 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,510
author_reputation14,988,697,980,664
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id142,890
net_rshares14,634,567,455
author_curate_reward""
vote details (5)
@nodex ·
Danke @marcelhattingh, dein Tipp <b>127</b> wurde notiert, viel GlΓΌck!
πŸ‘  
properties (23)
authornodex
permlinkre-re-xeroc-steem-api-20160714t113339648z
categoryundefined
json_metadata{"tags":["deutsch"],"app":"steemjs"}
created2018-09-27 07:12:36
last_update2018-09-27 07:12:36
depth2
children0
last_payout2018-10-04 07:12:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length70
author_reputation9,874,165,210,636
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,258,845
net_rshares170,989,019
author_curate_reward""
vote details (1)
@realskilled ·
Hi @xeroc,

Great post!

I'm looking for an API that allows me to create content (POSTs). I have been reading the documentation and it seems that we can only retrieve information or just create a comments or up-vote.

I wonder if you could point me to some API that allows creating POST in steemit.com.

Thanks,

@realskilled
properties (22)
authorrealskilled
permlinkre-xeroc-steem-api-20171008t222001326z
categoryundefined
json_metadata{"tags":[null],"users":["xeroc","realskilled"],"app":"steemit/0.1"}
created2017-10-08 22:20:00
last_update2017-10-08 22:20:00
depth1
children0
last_payout2017-10-15 22:20:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length325
author_reputation-65,196,368,224
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,143,421
net_rshares0
@steemboy ·
thanks for the post, would you happen to have any ideas on how i can programatically post to steemit with an API?
properties (22)
authorsteemboy
permlinkre-xeroc-steem-api-20170806t065317491z
categoryundefined
json_metadata{"tags":[null],"app":"steemit/0.1"}
created2017-08-06 06:53:18
last_update2017-08-06 06:53:18
depth1
children0
last_payout2017-08-13 06:53:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation-4,629,348,551
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id10,917,060
net_rshares0
@vaerospace ·
https://steemit.com/life/@vaerospace/it-seems-that-if-you-dare-use-a-footer-in-your-comments-mentioning-your-posts-or-sevices
properties (22)
authorvaerospace
permlinkre-xeroc-steem-api-20171026t142444923z
categoryundefined
json_metadata{"tags":[null],"links":["https://steemit.com/life/@vaerospace/it-seems-that-if-you-dare-use-a-footer-in-your-comments-mentioning-your-posts-or-sevices"],"app":"steemit/0.1"}
created2017-10-26 14:24:33
last_update2017-10-26 14:24:33
depth1
children0
last_payout2017-11-02 14:24:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length125
author_reputation1,406,057,356,244
root_title"Steem API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id18,620,291
net_rshares0