JIRA REST API create and update users and groups

Olivier Vandevoorde March 12, 2013

Is it possible to create and update users and groups in JIRA 5.1.3 through the REST API? If not, what are the alternatives for automation?

9 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
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2013

JIRA Command Line Interface has addUser and other user management actions for managing the primary user directory.

1 vote
Poul Sørensen February 16, 2015

Well, I found the solution:

deactivating/disablling a user is the same as removing the user from all groups:

DELETE https://.../group/user?groupname=$groupname&username=$username

Keith Weinheimer June 8, 2015

Poul, where I try to remove a user following your example with curl

 

curl -D- -u kweinheimer:pswd-X DELETE -H "Content-Type: application/json" -k https://jira-dev.mydomain.net/rest/api/2/group/user?groupname=jira-ba&username=myuser

 

I get this response

 

{"errorMessages":["Cannot remove user. 'null' does not exist"],"errors":{}}

1 vote
Wojciech Seliga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2013

Hey, REST API does not support it yet. No ETA at the moment, but I cannot see any strong reason why it should not be part of JIRA soon.

Currently you would have to resort to old SOAP interface (provided by RPC plugin bundled with JIRA) - http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html - which has a methods for manipulating users and groups you need. AFAIK JIRA Command Line Interface (CLI) depends on it too.

Bad news is that SOAP is deprecated as of 6.0 and will most likely be removed in 7.0 (I guess around 2014).

So if you don't want to rely on a soon deprecated stuff, I'd write your own REST service as is already suggested somehere.

MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2014

It looks like there is a POST in the REST API now to create a user (6.3)

https://answers.atlassian.com/questions/199172/using-rest-api-to-create-a-user-account-in-on-demand-jira

1 vote
codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2013

No, concerning to REST API documentation http://docs.atlassian.com/jira/REST/latest/#id122896 it is not possible. The only way to do that is to write your own plugin which provides a REST interface.

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2013

This feature is not on the roadmap of jira (I think because of security reasons). You have to implement it on your own.

Teddy Karambelas March 12, 2013

Is this functionality being worked on? When can we expect a release?

0 votes
andrea schneider July 5, 2018

Hi

Is there a way to change the first_name, last_name, display_name and the email_address with a REST call? I was trying to update the fields directly in the database table cwd_user, but couldn't see any changes in UI. We have to change user information for former users because of GDPR.

Thanks a lot for your help

andrea schneider July 5, 2018

I guess I found a solution I can send a PUT request with these data:

{"name": "xxxx", "emailAddress": "xxxx@email.com","displayName": "xxxx"}

The first_name field will remain empty, but that's fine.

0 votes
Ruchi Tandon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 5, 2017

Try this one. It worked for me  : 

curl -u USER:PASS -X DELETE -H "Content-Type: application/json" http://localhost:8722/jira/rest/api/2/group/user?groupname=jira-software-users\&\username=test

0 votes
Poul Sørensen February 14, 2015

https://docs.atlassian.com/jira/REST/latest/#d2e4067

 

GET/PUT/POST/DELETE user?username=foobar

except that DELETE does not work if  foobar  has  anything assigned to her (amongst other conditions)

 

Still digging dor a way to deactivate/disablle a user - it is the recommended way, but very hard to find.

Keith Weinheimer June 8, 2015

I find I can update Full Name but I cannot change a user to be inactive via rest API

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2013

we had same requirement so developed our own plugin, for this rest api not available yet so suggest you to write your own REST plugin,

checkout the following doc to know how to develop custom rest plugin

https://developer.atlassian.com/display/DOCS/Incomplete+Plugin+Tutorial+-+Writing+REST+Services

0 votes
Teddy Karambelas March 12, 2013

I'm also searching for the answer to this.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events