create account

RE: Could not find method get_block_range by gtg

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @felixxx/could-not-find-method-getblockrange

· @gtg ·
You were using method:call which is pre-appbase style of calling stuff (should be deprecated in 2018 or so),
In link that you have provided: https://developers.hive.io/apidefinitions/#block_api.get_block_range
Examples are working one, take a look this:
```
curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}' https://gtg.openhive.network
```
properties (22)
authorgtg
permlinkqzskw5
categoryhive-dev
json_metadata{"links":["https://developers.hive.io/apidefinitions/#block_api.get_block_range"],"app":"hiveblog/0.1"}
created2021-09-21 16:09:42
last_update2021-09-21 16:09:42
depth1
children5
last_payout2021-09-28 16:09:42
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_length420
author_reputation461,812,694,713,691
root_title"Could not find method get_block_range"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id106,459,239
net_rshares0
@felixxx ·
Believe it or not: I spent the whole morning looking at that example, trying to figure out how I could make that work for me.

Thanks for nothing.
properties (22)
authorfelixxx
permlinkre-gtg-qzsl8a
categoryhive-dev
json_metadata{"tags":["hive-dev"],"app":"peakd/2021.09.1"}
created2021-09-21 16:17:00
last_update2021-09-21 16:17:00
depth2
children4
last_payout2021-09-28 16:17: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_length146
author_reputation217,880,366,374,124
root_title"Could not find method get_block_range"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id106,459,373
net_rshares0
@engrave ·
For future reference - jsonrpc is basically a POST request with JSON body, so anytime you want to port those examples from `curl` to `fetch`, `axios`, or whatever request library you're using, just copy the body from example:

I.e change this:

```
curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}' https://api.openhive.network
```

Into this:

```
<html>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
axios.post('https://api.openhive.network', {"jsonrpc":"2.0", "method":"block_api.get_block_range", "params":{"starting_block_num": 1, "count": 3}, "id":42}).then((result) => console.log(result.data))    
</script>
</html>
```

You can also use `hive-js` or `dhive` (although I'm not sure they support get_block_range request out-of-the-box).
👎  
properties (23)
authorengrave
permlinkre-felixxx-qzt13y
categoryhive-dev
json_metadata{"tags":["hive-dev"],"app":"peakd/2021.09.1"}
created2021-09-21 22:00:00
last_update2021-09-21 22:00:00
depth3
children3
last_payout2021-09-28 22:00: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_length863
author_reputation318,719,797,600,724
root_title"Could not find method get_block_range"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id106,465,402
net_rshares0
author_curate_reward""
vote details (1)
@felixxx ·
hive-js and dhive do not support get_block_range, otherwise, I would not be in this mess.
I am not trying to build my own library, but I kinda have to.

...everything's working for now. Thanks!
properties (22)
authorfelixxx
permlinkre-engrave-qztnnp
categoryhive-dev
json_metadata{"tags":["hive-dev"],"app":"peakd/2021.09.1"}
created2021-09-22 06:07:00
last_update2021-09-22 06:07:00
depth4
children2
last_payout2021-09-29 06:07: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_length193
author_reputation217,880,366,374,124
root_title"Could not find method get_block_range"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id106,472,934
net_rshares0