You are trying to call the RPC interface incorrectly. Your curl -
$ curl --digest -u rpcusername:rpcpassword -X POST \ 127.0.0.1:8332/json_rpc \ -d "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"getwalletinfo\"}" \ -H 'Content-Type:application/json'
has an incorrect path 127.0.0.1:8332/json_rpc
you are posting to. You should create your curl request with the following path - 127.0.0.1:8332/
.
Working example, printing verbosely with -v
$ curl -v --digest -u rpcusername:rpcpassword -X POST \ 127.0.0.1:8332/ \ -d "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"getwalletinfo\"}" \ -H 'Content-Type:application/json'