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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,373
Community Members
 
Community Events
176
Community Groups

Disable a user via API in Jira

Hello,

 

What is the process to disable a user via the API?

 

Thank you.

 

Best regards,

3 answers

1 accepted

0 votes
Answer accepted
Alexis Robert Community Leader Oct 22, 2019

Hi @Fernando André , 

 

you can follow Atlassian documentation to disable a user with the API : https://developer.atlassian.com/cloud/admin/user-management/rest/#api-users-account-id-manage-lifecycle-disable-post

 

Let me know if this helps, 

 

--Alexis

Hello,

 

That's for the Cloud Jira, I'm using Server.

Alexis Robert Community Leader Oct 22, 2019

Hi @Fernando André , 

 

this is the Server documentation : https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/user-removeUser

Keep in mind that this features is only available from Jira 8.3.0

Ok, unfortunately I'm still a bit behind. Thank you

Hi @Alexis Robert ,

I need your help as am new to JIRA Cloud. 

Could you please explain the step-by-step process that how to disable bulk users via the API?

Regards,

Prasad

Hi,

Running a Jira Server 8.13.6 I implemented a script that Disables the user, the script works fine, the commands get the responses OK and the "Active" state of the user is changed - every thing is fine there.

The strange thing is that when attempting to edit the Details of the User in the GUI - the "Deactivated Checkbox" is not ticked!

The user is inactive, and is not able to log in.

Appears to be a bug in the GUI? Will post question in forum also.

test2.PNG

RTFM: Everything works as expected - it says "Active" not "Deactivated"....

 

1 vote

this is my python code to do it:

 

import urllib3
import requests
import json
from requests.auth import HTTPBasicAuth

url = f"https://yourdomain.com/rest/api/2/user"
auth = HTTPBasicAuth("user", "password")
headers = {"Accept": "application/json", "Content-Type": "application/json"}
params = {"username": "jack"}
payload = json.dumps( {"active": False} )
requests.request("PUT", url, data=payload, params=params, headers=headers, auth=auth, verify=False)

Thanks @Rafael Costa 

I spent a while toying with jira python library - but that got me no where. Your example worked perfectly for me on Jira Data Center 8.20. 

Appreciate it.

None of the responses here *ACTUALLY* work. 

Suggest an answer

Log in or Sign up to answer