BitShares Forum

Main => General Discussion => Topic started by: Fox on May 06, 2016, 04:06:34 am

Title: Request - Wallet API Access Using curl
Post by: Fox on May 06, 2016, 04:06:34 am
May I request some assistance with the syntax to access the wallet-api using curl (not wscat)? I have reviewed the the following documentation:
http://docs.bitshares.eu/api/websocket.html#call-format
http://docs.bitshares.eu/api/wallet-api.html#wallet-calls

I am successful requesting get_dynamic_global_properties:
Code: [Select]
curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0,"get_dynamic_global_properties",[]], "id": 2}' http://127.0.0.1:8090/rpc
But fail requesting for help:
Code: [Select]
curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0,"help",[]], "id": 2}' http://127.0.0.1:8090/rpc
Thanks in advance for the assistance,
Fox
Title: Re: Request - Wallet API Access Using curl
Post by: xeroc on May 06, 2016, 05:17:33 am
Code: [Select]
curl --data '{"jsonrpc":"2.0","method":"call", "params":[0, "help", []],"id":0}' http://localhost:8092/rpc
works for me (different port)

The issue is that it returns a raw string that is pretty ugly.
What for do you need 'help' from the RPC?
Title: Re: Request - Wallet API Access Using curl
Post by: abit on May 06, 2016, 11:43:03 am
Are you talking about cli_wallet API, or witness_node API?
Title: Re: Request - Wallet API Access Using curl
Post by: Fox on May 06, 2016, 01:12:23 pm
My goal is to suggest_brain_key using curl. Help was an example that I expected would function similar. Thus far I've been issuing curl requests to the witness node socket. I've not thought to query the CLI wallet socket. Does each app have a distinct set of functions to return queries for? I have made the assumption that Help, Info, About and suggest_brain_key were supplied by the witness node.
Title: Re: Request - Wallet API Access Using curl
Post by: abit on May 06, 2016, 02:39:01 pm
My goal is to suggest_brain_key using curl. Help was an example that I expected would function similar. Thus far I've been issuing curl requests to the witness node socket. I've not thought to query the CLI wallet socket. Does each app have a distinct set of functions to return queries for? I have made the assumption that Help, Info, About and suggest_brain_key were supplied by the witness node.
CLI API set is CLI commands: info, about..
Witness_node API is another set.
Title: Re: Request - Wallet API Access Using curl
Post by: Fox on May 07, 2016, 03:34:49 am
RESOLVED:
Code: [Select]
curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0,"suggest_brain_key",[]], "id": 2}' http://127.0.0.1:8092/rpc

Not much different there. Just note the port it now connects to 8092 (cli_wallet) vs. 8090 (witness_node) prior. A simple, obvious error on my part.

Thanks both @abit and @xeroc for the pointers.