Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

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 ambiguous. Possible 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.

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...