how to update assignee on an issue via REST api

ofer hai March 20, 2015

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

7 answers

1 accepted

0 votes
Answer accepted
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2015

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 votes
Faisal Shamim November 18, 2020

Hello , 

I am using https://apitester.com/ to change assignee over to my Jira cloud instance, 

Can anyone please guide how to do . I am prettty new to use API to perform such actions. 

I tried using : curl -D- -u USERNAME -p -H "Content-Type: application/json" -X PUT -d '{"name":"ASSIGNEE"}' domain/rest/api/2/issue/ISSUE-KEY/assignee . But it didn't work

Thanks, 

Faisal

0 votes
Adity Dokania May 5, 2016

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

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2015

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

 

0 votes
ofer hai March 23, 2015

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 votes
ofer hai March 20, 2015

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.

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2015

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

Suggest an answer

Log in or Sign up to answer