Skip to content

Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error #141

@linga96

Description

@linga96

function ResolveJIRA()
{
[cmdletbinding()]
param([String] $ticketID)
$projectname="CAS-CPR-TESt"
$releasenum="1.0.0"
$deployid="1.0.0-dep-id"
#DMl execution logs
$logs="https://xxxxxx.octopus.com/app#/projects/"+$projectname+"/releases/"+$releasenum+"/deployments/"+$deployid
#scriptlogs
$url="https://xxxxxx.octopus.com.com/app#/projects/"+$projectname+"/releases/"+$releasenum
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $usernam,$passwor)))
$resturi ="https://jira.xxxx.com/rest/api/2/issue/"+$ticketID+"/transitions?expand=transitions.fields"
$b1='{
"update": {
"comment": [
{
"add": {
'
$b2=' "body": "JIRA resolved by octopus during datapatch fix. Click to view script logs '+$url+" Click here to view octopus logs "+$logs+'"'
$b3='
}
}
]
},
"transition": {
"id": "121"
},
"fields": {
"resolution": {
"name": "Done"
}
}
}'
$body=$b1+$b2+$b3
write-host $resturi testing.....invoke command
Invoke-RestMethod -uri $resturi -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method post -ContentType "application/json" -Body $body
Write-Host "JIRA updating success"

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions