Can't update jira issue with REST API

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 vote
Tarun Sapra Community Champion Aug 09, 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 vote
Tarun Sapra Community Champion Aug 09, 2016
Tarun Sapra Community Champion Aug 09, 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.

0 vote
Tarun Sapra Community Champion Aug 10, 2016

has you issue been resolved?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

300 views 3 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you