We have a project in which several tickets are created in JIRA via REST API. For testing, I used the Jira Python libary, where I created, edited and linked tickets, which worked without any problems. However, I now want to map this in a powershell script so that no dependencies have to be installed if the script should ever run on another server. I use the same credentials to authenticate myself The creation of tickets, as well as the editing of assignee / reporter & writing comments works without any problems. Only connecting tickets does not work. I have tried the following way:
$headers = @{ “Authorization“ = ‘Basic ’ + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(”${username}:${apitoken}")) “Content-Type” = ”application/json” } $issueKey1 = “ITSM-251011” $issueKey2 = “ITSM-251012” $body = @{ type = @{ name = “Relates” } inwardIssue = @{ key = $issueKey1 } outwardIssue = @{ key = $issueKey2 } } | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri “https://testo-web.atlassian.net/rest/api/2/issueLink” -Headers $headers -Method Post -Body $body The following error was returned:Invoke-RestMethod : The remote server returned an error: (404) Not found. In C:\Users\Niklas\Desktop\Unnamed1.ps1:24 characters:1 + Invoke-RestMethod -Uri “https://company-web.atlassian.net/rest/api/2/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand A closer look at the error revealed that this was the error: ResponseBody: {“errorMessages”:[“No issue link type with name ‘duplicates’ found.”], “errors”:{}} I then took a look at the content of the Issuelinks field of an existing and linked ticket, but this is listed there as duplicates It didn't work with Relates to either, (in Python with the library it worked by specifying Relates to) I also tried to fill the Issuelink field directly when creating the ticket, but this did not work either (405)
We have a project in which several tickets are created in JIRA via REST API. For testing, I used the Jira Python libary, where I created, edited and linked tickets, which worked without any problems. However, I now want to map this in a powershell script so that no dependencies have to be installed if the script should ever run on another server. I use the same credentials to authenticate myself The creation of tickets, as well as the editing of assignee / reporter & writing comments works without any problems. Only connecting tickets does not work. I have tried the following way: $headers = @{ “Authorization“ = ‘Basic ’ + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(”${username}:${apitoken}")) “Content-Type” = ”application/json” } $issueKey1 = “ITSM-251011” $issueKey2 = “ITSM-251012” $body = @{ type = @{ name = “Relates” } inwardIssue = @{ key = $issueKey1 } outwardIssue = @{ key = $issueKey2 } } | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri “https://testo-web.atlassian.net/rest/api/2/issueLink” -Headers $headers -Method Post -Body $body The following error was returned:Invoke-RestMethod : The remote server returned an error: (404) Not found. In C:\Users\Niklas\Desktop\Unnamed1.ps1:24 characters:1 + Invoke-RestMethod -Uri “https://company-web.atlassian.net/rest/api/2/ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand A closer look at the error revealed that this was the error: ResponseBody: {“errorMessages”:[“No issue link type with name ‘duplicates’ found.”], “errors”:{}} I then took a look at the content of the Issuelinks field of an existing and linked ticket, but this is listed there as duplicates It didn't work with Relates to either, (in Python with the library it worked by specifying Relates to) I also tried to fill the Issuelink field directly when creating the ticket, but this did not work either (405) Translated with DeepL.com (free version)
Welcome to community!
Are you trying to create issue link between issues in 2 different jira sites?
Can you share the json body?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.