The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the Rest API from PowerShell to change the issue status?

Steve Campbell
May 3, 2023

I've been working with this for a while now. I know that this needs to be done as POST request. From what I've read, it looks like the JSON data should be this:

{"transition":{"id":"11"}}

My problem (I think) is that I can't seem to get it formatted correctly for the POST. I originally tried using curl (from Windows) but had no luck and switched to Powershell and Invoke-RestMethod. Here's the line as I currently have it:

Invoke-RestMethod -Uri "<Jira-BaseURL>/rest/api/latest/issue/<Issue-Key>/transitions" -Headers @{Authorization = "Bearer $JiraPAT"} -Method Post -Body $body -ContentType "application/json"

Can anyone tell me how to declare the variable $body to work with this? 

I've had successful GET requests so I know my authentication is working.

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.