Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,592
Community Members
 
Community Events
184
Community Groups

Unable to create ticket via JiraPS - Invoke-JiraMethod: Issue Does Not Exist

Edited

Hi,

After a recent upgrade to our development environment, I can no longer create tickets via powershell using JiraPS.

I'm still able within our production environment fine, however when I attempt to create the ticket via "New-JiraIssue", I get an error: "Invoke-JiraMethod: Issue Does Not Exist"

However the issue does exist under the project...

I don't think it's permissions as I can query and retrieve data using the Get-JiraIssue query command with no issue.

Any ideas/ suggestions would be appreciated.

Thanks

James

2 answers

0 votes
Dahc
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Feb 03, 2023 • edited Jun 05, 2023

I ran into this, it appears to be related to Jira changing the API in version 9. See the open issue below on the JiraPS github:

https://github.com/AtlassianPS/JiraPS/issues/461

I stumbled upon this from search, so figured I'd post this to help others.

Edit: Looks like Jira 8.4 introduced this change, so even if you used Invoke-RestMethod some code change will be required:
https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#creating-an-issue-examples

For anyone arriving here via google:

$pair = "${username}:${password}"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$headers = @{ Authorization = "Basic $base64" }

$body = @{
fields = @{
project = @{
key = "ProjectKeyHere"
}
issuetype = @{
name = "Task"
}
summary = "Test Issue via API"
}
}
# Convert the body to JSON format
$body = $body | ConvertTo-Json

Invoke-RestMethod -uri "https://ServerURLHere/rest/api/2/issue" -Method Post -Headers $headers -ContentType "application/json" -Body $body

You can also modify the JiraPS file as shown here:
https://github.com/spicy/JiraPS/commit/fc2632c1f21b3867667197ec2c8e77b266e60e69

0 votes
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 03, 2022

Hello @James Underdown 

This is the risk you take with using third party libraries.

Switch to using PowerShell's native Invoke-RestMethod.  It does mean a bit more coding work on your part, but it always works.

@David Bakkers  have you figured this issue? Can you share you code on how to create issue. Thanks

Dahc
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Jun 05, 2023 • edited

@Rodolfo So I ended up having to use invoke-restmethod, I updated my post above with a code example.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events