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?
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
Edit: Nevermind, I figured it out. The script that you provided was depreciated. I figured out another method though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you mind sharing the method you found to deactivate user using API call?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.