how to update assignee on an issue via REST api

Hi,

I'm using JIRA REST api 6.3 and trying to update the assignee on a given issue,

I've managed to create issues, so i assume there is nothing wrong with my credentials and positing method.

I've tried both POST and PUT method on "https://<mycompany>.atlassian.net/rest/api/2/issue/<KEY>/editmeta" and "https://<mycompany>.atlassian.net/rest/api/2/issue/<KEY>" .

I've tried using "{ "fields" : { "assignee" :{"name" : "xxx\}  } }" and

{ "update" : { "assignee" : [{"set" : {"name" : "xxx"} } ] } }

I always get the same response ...

{"The remote server returned an error: (405) Method Not Allowed."}

What am I doing wrong here, according to the documentation it should work ...

Regards,

Ofer s.Hai

6 answers

1 accepted

This widget could not be displayed.

Hello Ofer,

Thank you for your question.

How can i assign an issue to a sprint?

# USERNAME, i.e.: myuser
# ISSUE-KEY, i.e.: ABC-1
# CUSTOMFIELD-ID, is the Rank custom field ID (i.e.: 10004)
# SPRINT-ID, is the ID of the sprint (i.e.: 1)
# BACKLOG, is false since we are adding the issue to a sprint not ranking the issue in backlog (i.e.: false)
# DOMAIN, i.e.: mycompany
curl -D- -u USERNAME -p -H "Content-Type: application/json" -X PUT -d '{"idOrKeys":["ISSUE-KEY"],"customFieldId":CUSTOMFIELD-ID,"sprintId":SPRINT-ID,"addToBacklog":BACKLOG}' https://DOMAIN.atlassian.net/rest/greenhopper/1.0/sprint/rank

By running the command above, you will be prompted to type in your password. Alternative, you could add the password to the "curl" command as per following (please, notice the password will be visible if you choose this option):

# USERNAME, i.e.: myuser
# PASSWORD, i.e.: mypassword
curl -D- -u USERNAME:PASSWORD ...

In JIRA Agile REST API (Please uncheck the 'Show only public APIs)

You could also refer to JIRA REST API for other api calls.

I would kindly ask you to vote on the answer to increase its visibility in case you find this answer resourceful.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

Hello Ofer,

Thank you for your question.

Could you please run the following command:

# USERNAME, i.e.: myuser
# ASSIGNEE, i.e.: otheruser
# ISSUE-KEY, i.e.: ABC-1
# DOMAIN, i.e.: mycompany
curl -D- -u USERNAME -p -H "Content-Type: application/json" -X PUT -d '{"name":"ASSIGNEE"}' https://DOMAIN.atlassian.net/rest/api/2/issue/ISSUE-KEY/assignee

By running the command above, you will be prompted to type in your password. Alternative, you could add the password to the "curl" command as per following (please, notice the password will be visible if you choose this option):

# USERNAME, i.e.: myuser
# PASSWORD, i.e.: mypassword
curl -D- -u USERNAME:PASSWORD ...

 

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

Hi Rafael,

Thank you for your helpful reply.

I wonder how come this solution was not documented at all ? Am i looking at the wrong location:

https://developer.atlassian.com/jiradev/api-reference/jira-rest-apis

If so please refer me to a valid documentation.

Another Q: How can i assign an issue to a sprint ?

Ofer.

This widget could not be displayed.

Hi Rafael,

Thank you for your response, I'm a bit confused here:

What custom field should i use and where can i find the sprint id, i only have the sprint number in the current project. why should i call addtobacklog ?nd what value should i put in ?

Is it only 'BACKLOG' text ?

Thank you in advance .

Ofer.

This widget could not be displayed.

Hello Ofer,

I would kindly suggest you on, when in JIRA please hit "g" twice on your keyboard (i.e.: g + g). This will open a dialog box in the top-center of your screen.

In the dialog box, please enter:

For "SPRINT-ID", please click on "Agile" located at the top menu and select a board. After that, select "Reports" in the left-menu. In the URL, you should find "view=reporting&chart=sprintRetrospective&sprint=X" where "X" is the SPRINT-ID.

Regarding on "addToBacklog", as mentioned previously, you have to provide a boolean value (true || false). If you are planing to add this issue to the backlog you should use "true", otherwise, "false" to add it to the sprint.

Kind regards,
Rafael P. Sperafico
Atlassian Support

 

This widget could not be displayed.

Do we have a solution to this? I have the exact same issue

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

128 views 2 0
Join discussion

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