Author Topic: Calling "about"-method of Bitshares-Client 0.4.27.2 in Win64 not working via cUR  (Read 1649 times)

0 Members and 1 Guest are viewing this topic.

Offline okidoki

  • Full Member
  • ***
  • Posts: 64
    • View Profile
Thanks for your answer, I had to do another change as well:
"C:\Program Files\BitShares\bin\bitshares_client.exe" --rpcuser user  --rpcpassword pass --server --httpport 4000
curl --data "{\"method\":\"about\",\"params\":[],\"json-rpc\":2.0,\"id\":0}" http://user:pass@localhost:4000/rpc

For all who wonder, I opened the normal bitshares client instead of "bitshares_client.exe --server". Also port 9990 was occupied by another program... The escaping went fine as well, but had to change apostrophes.

Offline arubi

  • Sr. Member
  • ****
  • Posts: 209
    • View Profile
Try like this:

Code: [Select]
curl --data '{\"method\":\"about\",\"params\":[],\"json-rpc\":2.0,\"id\":0}' http://rpcuser:testpassword@localhost:9990/rpc

Also, it's better not to use spaces in the data. They shouldn't be there.

Offline okidoki

  • Full Member
  • ***
  • Posts: 64
    • View Profile
In this discussion regarding connecting via RPC using curl to the BitShares Client an example is given about how to call the "about"-method via JSON-RPC:
https://bitsharestalk.org/index.php?topic=5562.0

I edited the config.json like this: "rpc": { "enable": true, "rpc_user": "rpcuser", "rpc_password": "testpassword", "rpc_endpoint": "127.0.0.1:9989", "httpd_endpoint": "127.0.0.1:9990", "htdocs": "./htdocs" },.......


Then I started the Client and issued the following cURL:

curl --data '{"method":"about", "params": [], "json-rpc": 2.0, "id": 0}' http://rpcuser:testpassword@localhost:9990/rpc

Response: curl: (6) Could not resolve host: params curl: (3) [globbing] bad range specification in column 2 curl: (6) Could not resolve host: json-rpc curl: (6) Could not resolve host: 2.0, curl: (6) Could not resolve host: id curl: (3) [globbing] unmatched close brace/bracket in column 2 ! ┬>▲ ∟Failed to parse the request.

What am I doing wrong here?

Thanks for your help in advance!