fortify / fcli

fcli is a command-line utility for interacting with various Fortify products
https://fortify.github.io/fcli/
Other
31 stars 22 forks source link

How to run `fcli * rest call` with query parameters in powershell #621

Closed MikeTheSnowman closed 1 month ago

MikeTheSnowman commented 1 month ago

Question

I'm not personally asking a question here, but rather posting the answer to this question as I'm sure that there will be people in the future who will encounter this issue when using fcli * rest call from powershell, in the future.

Take the following example command: fcli ssc rest call -X GET "/api/v1/issues?q=name%3A%22**%22&fulltextsearch=true"

If you were to try and run the following command in powershell, you will encounter the following error: 'fulltextsearch' is not recognized as an internal or external command

You get this error because the ampersand character (&) in powershell has special meaning and powershell will think that you're trying to run a command. Normally, people typically use powershell a lot, will try to escape the ampersand character with the back-tick character (`), but this will not work.

Instead, what you will need to do is to add --% just before the url/api that you're trying to call. Your updated command should look something like the following: fcli ssc rest call -X GET --% "/api/v1/issues?q=name%3A%22**%22&fulltextsearch=true"

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.4#the-stop-parsing-token