1

Following the guide at https://blog.infura.io/getting-started-with-infura-28e41844cc89, step 2 after registering is to send a HTTPS POST using curl. The command is

curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' https://mainnet.infura.io/MYAPIKEY

But when I try this (with my actual API key in place in the url) I get an error

Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'.
At line:1 char:6
+ curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion"," ...
+      ~~
+ CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

I am using windows 10 powershell and have downloaded curl-7.60.0-win64-mingw, which I ran by running the curl.exe in the bin folder.

According to another answer on stackoverflow that recommended using the command

Remove-item alias:curl 

on windows 10 to avoid that specific Invoke-WebRequest error, and then running the curl command. When I do this I get no error, but nothing happens. There is no JSON returned with the Client and version, like the tutorial says their should be.

How do I get this to work? I can't follow the tutorial with these problems.

Thanks to anyone that can help.

2 Answers 2

1

just run on my shell, it return correct result.

    $ curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' https://mainnet.infura.io
{"jsonrpc":"2.0","id":1,"result":"Geth/v1.8.15-omnibus-255989da/linux-amd64/go1.10.1"}
0

The code is OK, but infura must have overspent on designing the frontend to their site because symbols for the CLI have been replaced with prettier ones!

should be "

should be '

should be --

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.