command:
curl --user : -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:”2.0",“from”:“hz”,”method”:”eth_blockNumber”,”params”: [],”id”:1}’ https://mainnet.infura.io/v3/a5bd0dfaaca84a40b48191c647525cb6
result:
{“jsonrpc”:“2.0”,“error”:{“code”:-32600,“message”:“invalid json request”}}
Hi @Igor_Vasilchikov - welcome to the Infura community!
A couple of things - first, it looks like you have an additional parameter of "from":"hz"
and the --user
as it’s an unnecessary parameter, so I would start by removing those. I would also put your URL directly after the curl
command, as our docs show, and you’ll get rid of the "invalid json request"
error. However, when I run that code, I get an error of "rejected due to project ID settings"
, so I would double-check that your project settings are correct.
We have a great example of setting up your curl request in our docs, as well as a really informative blog post about project settings to make sure everything is set up correctly there.