The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Using the Jira API to Deactivate a User

Michael Hypnarowski
July 31, 2018

I see that there is a functionality to GET a user's details through the Jira Cloud REST API (see link) which returns a property including the "active" field. My understanding is that if this field were set to "false", then the user would be deactivated. Is there a way to set this to "false" through an API call?

 

If not, is there currently any other way to deactivate a user in JIRA through the API?

2 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
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 2, 2018

Hey, Michael. Thanks for reaching out the Atlassian Community!

Currently, there's no REST API call that can deactivate a user. For that, there's a feature request created in order to implement this feature:

Looking through the comments I was able to find a workaround that I suggest you test and see if it works for you:

curl -u USERNAME:PASSWORD --header "X-Atlassian-Token: no-check" -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json" -X POST https://<INSTANCE>/admin/rest/um/1/user/deactivate?username=<user_to_deactivate>

I believe this is mimicking GUI behavior in order to deactivate the user.

Kind regards,
Maurício Karas

Michael Hypnarowski
August 2, 2018

Edit: Nevermind, I figured it out. The script that you provided was depreciated. I figured out another method though.

Ravi Varma
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 Champions.
August 8, 2018

Hi @Michael Hypnarowski,

In addition to your research, I found this code to deactivate user:

ImmutableUser.newUser(user).active(false).toUser();

And then use 

UserService.UpdateUserValidationResult result = userService.validateUpdateUser(user);

 

Regards,

Ravi Varma

1 vote
EPS Team
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!
December 19, 2018

@Michael Hypnarowski

Would you mind sharing the method you found to deactivate user using API call?

TAGS
AUG Leaders

Atlassian Community Events