REST Service call via POSTMAN

+2 votes

Hi Team,

I have a very basic question. I want to get response of below call via POSTMAN -

streamchain: getinfo
{"method":"getinfo","params":[],"id":1,"chain_name":"streamchain"}

 My config file is as below -

rpcuser=multichainrpc
rpcpassword=XXXXXXXX
rpcallowip=0.0.0.0/0
rpchost=127.0.0.1

Blockchain parameters is as below -

  •   "default-network-port" : 6271
  •   "default-rpc-port" : 6270
  •    "nodeaddress" : "streamchain@X.Y.Z.A:6271

In POSTMAN -

Authorization Section: Type ->"Basic Auth" Username -> multichainrpc Password ->rpcpassword

Header Section: Content-Type -> Application/JSON

Body Section: Selected "raw" type & added this: {"method":"getinfo","params":[],"id":1,"chain_name":"streamchain"}

Call Type : POST

URL: http://X.Y.Z.A:6271/

I am not receiving any response although my cli is working fine.

Please let me know if I am making any mistake.

 

 

 

 

asked Aug 17, 2018 by anonymous

1 Answer

+1 vote
I'm not sure sure how Postman works but at the very least, you need to use the default RPC port for API requests, not the default network port.
answered Aug 19, 2018 by MultiChain
Thanks I am able to successfully receive response. URL should be the Localhost address where multichain is installed & as mentioned port is the RPC port.
Great, glad to hear you got it resolved.
Hi, I got the same problem, but I stopped on "Error: connect ECONNREFUSED". Any clues? Thank you!

Here are the details from postman console:

POST http://X.X.X.X:7404/
Error: connect ECONNREFUSED X.X.X.X:7404
Network
Request Headers
Content-Length: application/json
Authorization: Basic bX...
Content-Type: text/plain
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Cache-Control: no-cache
Postman-Token: dd...
Host: X.X.X.X:7404
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Request Body
{"method":"getinfo","params":[],"id":1,"chain_name":"mychain"}
By default the node only accepts JSON-RPC requests from its own localhost. You can change this using a runtime parameter, please search this Q&A for the word 'rpcallowip'.
...