Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×

Forums

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

Can't update jira issue with REST API

red888
Contributor
August 9, 2016

I'm trying to do this with powershell, but I'm getting 400 errors:

 

$RESTURL = 'https://mycomp.atlassian.net/rest/api/latest/issue/PROJ-61'
$body = '{"fields":{"assignee":{"name":"me"}}}'
$restcreds = [System.Convert]::ToBase64String(
[System.Text.Encoding]::ASCII.GetBytes(('me' + ":" + 'mypass123'))
)
$httpheader = @{Authorization = "Basic $restcreds"}
$restParameters = @{
Uri = $RESTURL;
ContentType = "application/json";
Method = "PUT";
Headers = $httpheader;
Body = $body;
}
Invoke-RestMethod @restParameters

If I remove "body" from the request and change it to a get I get back data successfully. It seems I just get modify the ticket

3 answers

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2016

Here is your answer - https://answers.atlassian.com/questions/156863

Make sure you have assignee field on the edit screen of the issue.

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 10, 2016

has you issue been resolved?

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2016
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2016

From the docs - "The simple way to update an issue is to do a GET, update the values inside "fields", and then PUT back."

Thus do a get request and then then a put request with the same json data and just modify the "assignee" filed to a proper user ID , "me" isn't a userId it seems which you are doing right now.

Suggest an answer

Log in or Sign up to answer