EOSCommunity.org Forums

Unable to call get_table_rows api endpoint

Hi there, i am trying to access the get_table_rows endpoint, via using the https://wax.greymass.com/v1/chain/get_table_rows endpoint.

I supply it with the 3 required params which are code,table,scope, so the end query looks like

https://wax.greymass.com/v1/chain/get_table_rows?code=somethinghere&table=somethinghere&scope=something here

But, that returns me this message below

{
“code”: 404,
“message”: “Not Found”,
“error”: {
“code”: 0,
“name”: “exception”,
“what”: “unspecified”,
“details”: [
{
“message”: “Unknown Endpoint”,
“file”: “http_plugin.cpp”,
“line_number”: 597,
“method”: “handle_http_request”
}
]
}
}

EOSIO APIs like WAX don’t natively support GET type requests, you need to do a POST request to the API endpoint in order to receive data back.

A CURL request with post data shows this:

curl https://wax.greymass.com/v1/chain/get_table_rows -d '{"json":true,"code":"eosio","scope":"eosio","table":"global"}'

Which returns:

{"rows":[{"max_block_net_usage":1048576,"target_block_net_usage_pct":1000,"max_transaction_net_usage":524288,"base_per_transaction_net_usage":12,"net_usage_leeway":500,"context_free_discount_net_usage_num":20,"context_free_discount_net_usage_den":100,"max_block_cpu_usage":200000,"target_block_cpu_usage_pct":2500,"max_transaction_cpu_usage":150000,"min_transaction_cpu_usage":100,"max_transaction_lifetime":3600,"deferred_trx_expiration_window":600,"max_transaction_delay":3888000,"max_inline_action_size":4096,"max_inline_action_depth":6,"max_authority_depth":6,"max_ram_size":"140995619840","total_ram_bytes_reserved":"102729776288","total_ram_stake":"1220472111685310","last_producer_schedule_update":"2022-01-05T01:46:56.500","last_pervote_bucket_fill":"2022-01-05T01:46:57.500","pervote_bucket":0,"perblock_bucket":"192220281687468","voters_bucket":"51559158969241","total_voteshare_change_rate":"56211868798353806370729719624239834776731648.00000000000000000","total_unpaid_voteshare":"23670611574850632539132487690025951705005318733824.00000000000000000","total_unpaid_voteshare_last_updated":"2022-01-05T01:47:09.000","total_unpaid_blocks":3240771,"total_activated_stake":"150287586392356596","thresh_activated_stake_time":"2019-06-24T18:02:24.000","last_producer_schedule_size":21,"total_producer_vote_weight":"1233030859885509693915339082892835554571845632.00000000000000000","last_name_close":"2021-12-30T02:35:56.500"}],"more":false,"next_key":""}

Hi Aaron, I too am having this problem. I tried running your example above but am getting a code 500 internal service error message.
Any thoughts on why I can’t get it to work?

curl https://wax.greymass.com/v1/chain/get_table_rows -d ‘{“json”:true,“code”:“stake.mars”,“scope”:“thundermars1”,“table”:“stakes”}’
{“code”:500,“message”:“Internal Service Error”,“error”:{“code”:4,“name”:“parse_error_exception”,“what”:“Parse Error”,“details”:[{“message”:“Unexpected char ‘39’ in “””,“file”:“json.cpp”,“line_number”:436,“method”:“variant_from_stream”},{“message”:"",“file”:“json.cpp”,“line_number”:459,“method”:“from_string”}]}}

The quotes you are using are from word or something, and not valid syntax for the command.

curl https://wax.greymass.com/v1/chain/get_table_rows -d '{"json":true,"code":"stake.mars","scope":"thundermars1","table":"stakes"}'

That’ll work, with just normal quotes.

Hi Aaron, thanks for your help. I attempted to use the command you suggested and still getting the same error…

I’m assuming you can just type this into your command prompt line? I’m kinda new to this so maybe I am missing something?

All fixed now, it appears as though you need to use triple quotation marks when using Windows…
Thanks for your help Aaron.