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

0 vote

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

0 vote

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

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.

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.

0 vote

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

 

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

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 Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

629 views 6 12
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