In below code, I need to check if version string is not empty then append its value to the request variable.
if ([string]::IsNullOrEmpty($version)) { $re
if (-not ([string]::IsNullOrEmpty($version))) { $request += "/" + $version }
You can also use ! as an alternative to -not.
!
-not