How to send curl update request with -d parameter? How to send curl update request with -d parameter? curl curl

How to send curl update request with -d parameter?


curl is an alias for PowerShell - Invoke-WebRequest, hence the error.

# Get parameters, example, full and Online help for a cmdlet or function(Get-Command -Name Invoke-WebRequest).ParametersGet-help -Name Invoke-WebRequest -ExamplesGet-help -Name Invoke-WebRequest -FullGet-help -Name Invoke-WebRequest -OnlineGet-Alias -Definition Invoke-WebRequest | Format-Table -AutoSize -WrapCommandType Name                      Version Source----------- ----                      ------- ------Alias       curl -> Invoke-WebRequest               Alias       iwr -> Invoke-WebRequest                Alias       wget -> Invoke-WebRequest    

If you are trying to use real curl in PowerShell, then you must use curl.exe, or remove the curl alias from Invoke-WebRequest.

The errors are because passing parameters/arguments that Invoke-WebRequest has no idea what they are or what to do with the.

If you are trying to use external tools in PowerShell, then you have to fully qualify the UNC and name including the externtion, to them and remember that using external tools with PowerShell, this must be approached in a defined way.

For example:

See Using Windows PowerShell to run old command line tools (and their weirdest parameters) 'https://blogs.technet.microsoft.com/josebda/2012/03/03/using-windows-powershell-to-run-old-command-line-tools-and-their-weirdest-parameters'

See also this post regarding trying to use real curl with PowerShell.

How to use the curl command in PowerShell?

Am using the curl command in PowerShell to post the comment in bit-bucket pull request page through a Jenkins job. I used the below PowerShell command to execute the curl command, but am getting the error mentioned below. Could anyone please help me on this to get it worked?

How to use the curl command in PowerShell?


I managed to do what I needed with

$url = "https://api.box.com/2.0/users/111111111"$headers = @{"Authorization" = "Bearer TOKEN"}$body = '{"status": "inactive"}'$contentType = "application/json"Invoke-WebRequest $url -Headers $headers -ContentType $contentType -Body $body -Method PUT

So it seems that not only did I need to replace the -D parameter with -Body, but I also had to specify the ConteType as application/json in order to use that format.