I am trying to invoke a rest method in powershell to jira from teamcity. The URL needs to be correctly encoded to work correctly. If I remove these encoded characters I do not get the correct result returned. Looking at examples and otehr sources the jql requires the encoded as such.
my uri is
https://localhost:8443/rest/api/2/search?jql=project%20%3D%20CPS%20and%20fixVersion%20%3D%203.25
however everytime I enter this in teamcity my build config is prompted for 4 new variables. I understand why teamcity thinks this but I have tried everything to 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 is 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 anyone suggestion anything else ?