Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
  • Community
  • Answers Developer Questions
  • Questions
  • How to create User roles in JIRA using JIRA Rest API?? I need to create user using JIRA Rest API and assign Role to him/her. I can create user but can not assign or create role. Is there any API to create "Project Role" [Ex.developer] & assign to user?

How to create User roles in JIRA using JIRA Rest API?? I need to create user using JIRA Rest API and assign Role to him/her. I can create user but can not assign or create role. Is there any API to create "Project Role" [Ex.developer] & assign to user?

 

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted

Ok, to give an example: Adding user johndoe to role with id 12345 for project with key DEMO would be done like this:

You will get a response with status code 200 if it was successfull, 404 otherwise.

Restrictions: Such a REST request is for exactly 1 project and 1 role. If you want to add the new user to multiple project roles, you have to send multiple REST requests.

Hello Andreas Ebert, Thank you very much. :) Appreciate your Help..:)

How can you deselect a role if it is already set and you want to change it?

Hello Andreas Ebert,

Thanks for your help. From API , I can Create Project Roles according to project. But How can assign specific role when I create user using REST API??

For example I have create role "developers" manually from Admin ==> System ==> Roles ==> Create New Role or using REST API.

After I create project role developer, I want to create user which have project role "developer".

I can do it manually like,

Admin ==> User Management ==> User list ==> Edit Project roles ==> assign using checkbox.

But How can I do it using REST API while create user using REST API.??

 

The REST resource /rest/api/2/project/{projectIdOrKey}/role/{id} is what you want to use. Assigning users (or groups) to roles is always done in the context of a specific project. And the calling user must have the "Administer Project" permission for that project, in order for him to be able to do it.

TAGS
Community showcase
Published in Marketplace Apps & Integrations

🚀 Weekly Atlassian News Roundup by Jexo & Easy Agile | 20th September 2021

Good morning community 👋, As every week we prepared a roundup of the latest news from across the Atlassian ecosystem on our Monday Coffee with Jexo podcast. This week we were delighted to have a...

77 views 2 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you