404 page not found

Hi,

404 page not found

Why I am getting this error?

39%20PM

Try sending a full RPC request using your key, something similar to:

curl https://mainnet.infura.io/v3/[YOUR PROJECT ID] -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“eth_blockNumber”,“params”:[],“id”:74}’

More details can be found in the docs on our website.

2 Likes

Make sure there is no space between “Type:” and “application” in “Content-Type:application/json”. It took me quite a while to make it work.

Hello, I cannot get this to work . Even pasting the URL with my project ID in Firefox gives me a 404 error:

curl https://mainnet.infura.io/v3/[MY PROJECT NAME] -X POST -H “Content-Type:application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“eth_blockNumber”,“params”:[],“id”:74}’

what am I missing above ?

Hi @fovanessians, and welcome to the Infura community! Are you pasting in your project name or project id at the end of the URL? You will need to paste in the ID from your dashboard project settings page.

I got this to work with the following command:

curl -u :SECRET_ID -d ‘{“jsonrpc”:“2.0”,“method”:“eth_blockNumber”,“params”:[],“id”:1}’ https://mainnet.infura.io/v3/PROJECT ID

1 Like

I also have a question. If I am deploying a .SOL contract in CMD or BASH, then what is the point of using Infura? What does Infura help me do if I write, compile, and deploy a contract in command prompt or BASH?

Thanks for sharing your fix, @fovanessians!

As far as the .SOL contract question, Infura basically makes it easier for you to develop and interact with your Smart Contract without having to run and maintain your own Ethereum node, which will speed up your dev workflow and make life easier on your machine.

Please am using my api link in react inside my .env file and it shows error 404.
I am only using it as a const in the js. How do i fix it without using curl?

could you please provide a sample on how you reference the environment variables in your code?