powershell - TeamCity sees string with % as a TeamCity Variable -
i trying invoke rest method in powershell jira teamcity. url needs correctly encoded work correctly. if remove these encoded characters not correct result returned. looking @ examples , otehr sources jql requires encoded such.
my uri is
https://localhost:8443/rest/api/2/search?jql=project%20%3d%20cps%20and%20fixversion%20%3d%203.25
however everytime enter in teamcity build config prompted 4 new variables. understand why teamcity thinks have tried escape them.
i have tried:
https://localhost:8443/rest/api/2/search?jql=project%%20%%3d%%20cps%%20and%%20fixversion%%20%%3d%%203.2 https://localhost:8443/rest/api/2/search?jql=project%%%20%%%3d%%%20cps%%%20and%%%20fixversion%%%20%%%3d%%%203.2 https://localhost:8443/rest/api/2/search?jql=project`%20`%3d`%20cps`%20and`%20fixversion`%20`%3d`%203.2
my usage below:
$jirafixversion = $version.substring(0,$length-5); $params = @{uri = "https://jira.rtdomau.local:8443/rest/api/2/search?jql=project%20%3d%20cps%20and%20fixversion%20%3d%20$($jirafixversion)"; method = 'get'; #(or post, or whatever) headers = @{authorization = 'basic ' + [convert]::tobase64string([text.encoding]::ascii.getbytes("$($user):$($password)")); } #end headers hash table } #end $params hash table $var = invoke-restmethod @params
can suggestion else ?
if you're not using dynamic values, use single-quotes string literal.
$params = @{ uri = 'https://jira.rtdomau.local:8443/rest/api/2/search?jql=project%20%3d%20cps%20and%20fixversion%20%3d%20$($jirafixversion)'; ...
Comments
Post a Comment