Forums

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

What value should be used in assignee filed while creating issue via rest api

shyam agrawal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2020

Hi, 

I am trying to create a jira issue via rest api, and confused what value should be supplied in `assignee`  field when I want to assign the jira to a specific user at time of jira creation itself. 

My flow has two steps:

  1. Get list of users via api
  2. iterate in above list, find user of interest and sent create issue api request with assignee filed as that user of interest.

Earlier before GDPR, I use to get list of all the users via API and use the field `key`  form the response for the user I want to assign.
But in latest versions `key` filed had been deprecated and new filed `accountId`  is supplied instead.

 

Will using `display-name` as assignee value work ? or do I need to use some other api call ?

1 answer

0 votes
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 21, 2020

Hello Shyam,

Welcome to Atlassian Community!

When assigning an issue using REST, it's necessary to use their ID. The ID is a unique identifier that will make the issue to be assigned to the correct person.

Testing here, I believe you can use the GET all users to get their accountID.

curl --request GET \
  --url 'https://site.atlassian.net/rest/api/3/users/search' \
 --user 'email@domain.com:<api-token>' \
  --header 'Accept: application/json'

The accountID is what appears when you access their profile on User management.

Screen Shot 2020-04-21 at 14.44.43.png

If you have any other questions regarding this matter, please let us know.

Regards,
Angélica

Suggest an answer

Log in or Sign up to answer