Using Powershell to Change Assignee and Add Comment to Issue via JIRA REST API -
for seemingly simple i'm having no luck updating jira issues via rest api.
has been able update jira issues using powershell? i've pretty exhausted options on stackoverflow , atlassian's website.
no scripts curl, invoke-restmethod or invoke-webrequest have done returned errors.
retrieving info issue not problem. changing it... holy cow.
i'd immensely grateful if me find way solve this.
thanks!
function convertto-base64($string) { $bytes = [system.text.encoding]::utf8.getbytes($string); $encoded = [system.convert]::tobase64string($bytes); return $encoded; } function get-httpbasicheader([string]$username, [string]$password, $headers = @{}) { $b64 = convertto-base64 "$($username):$($password)" $headers["authorization"] = "basic $b64" $headers["x-atlassian-token"] = "nocheck" return $headers } function add_comment([string]$issuekey,[string]$comment) { $body = ('{"body": "'+$comment+'"}') $comment=(invoke-restmethod -uri ($restapiuri +"issue/$issuekey/comment") -headers $headers -method post -contenttype "application/json" -body $body).id return $comment } $restapiuri = "https://jira.server.com/rest/api/2/" $headers = get-httpbasicheader "user" "password" add_comment "myissue-1234" "[~test.user] please handle issue."
Comments
Post a Comment