Monday, 3 May 2021

Powershell - CURL error Ambiguous parameters in the command

 Powershell - CURL error Ambiguous parameters in the command :


I tried to invoke bitbucket pipelines from API using CURL command. I installed CURL first in powershell using chocolatey - Choco install curl . Then opened a new window and tried by prebuilt POST request in curl .

$ curl -X POST -is -u username:password `

  -H 'Content-Type: application/json' `

 https://api.bitbucket.org/2.0/repositories/test/testdemo/pipelines/ `

  -d '

  {

    "target": {

      "ref_type": "branch",

      "type": "pipeline_ref_target",

      "ref_name": "master"

    }

  }'

First I used line separator as "\" in end of each line which is shell format which is not recognized by powershell . Later I replaced "\" with back quote "`" character. 

After entering the command , Powershell throws error like "Parameter cannot be processed because the parameter name 'u' is ambiguousPossible matches" 

Then I found that by default Powershell tried to call Invoke-Request alias instead of calling curl.exe. Stack overflow suggested to remove the alias and proceed. I removed the alias by executing the below command

Remove-item alias:curl
This did the magic and now my powershell is calling the bitbucket API to execute my pipeline.

1 comment:

zaccheusjackowiak said...

Best Casino & Hotel Hotels Near Richmond, VA - MapYRO
Browse real-time reviews and find the best Casino 울산광역 출장안마 & Hotel in Richmond, VA. See available 여수 출장샵 room rates, amenities, 전라북도 출장샵 and 과천 출장안마 request 화성 출장마사지 a quote.

Shrinking the size of Oracle Virtual Box

First, zero fill your virtual disk. Boot the VM and run: sudo dd if=/dev/zero of=/bigemptyfile bs=4096k status=progress sudo rm -f /bigempty...