I am trying to execute a curl command in powershell:
curl --user bitcoinipvision --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "move", "params": ["acc-1", "acc-2", 6, 5, "happy birthday!"] }' -H 'content-type: application/json;' http://localhost:18332/
But I get this error, what is the problem?
Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "content-type: application/json;" value of type "System.String" to type "System.Collections.IDictionary". At line:1 char:158 + ... 5, "happy birthday!"] }' -H 'content-type: application/json;' http:// ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
alias curl
, it apparently goes toInvoke-WebRequest
(not on my PowerShell though). If you want the realcurl
, explicitly usecurl.exe
. – Jeroen MostertInvoke-RestMethod
and full support for JSON (ConvertTo-Json
and the like). It's worth reading up on native PowerShell ways to do this. – Jeroen Mostert