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,552,048
Community Members
 
Community Events
184
Community Groups

Delete/Disable a user via API.

I am planning to automate user off-boarding using API.

https://developer.atlassian.com/cloud/admin/user-provisioning/rest/api-group-users/#api-scim-directory-directoryid-users-userid-delete

I have tried this using postman, but it returned 401.

{
    "code": 401,
    "message": "Unauthorized"
}
I have also created API and use it looks like it did not work.
Any help is appreciable.

1 answer

1 accepted

1 vote
Answer accepted
Neil
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 07, 2021

Hi @Arshadul Huq. Welcome to the community! This set of APIs (Cloud Admin) can only be used on managed accounts for which there is an organization and a verified domain. The other condition is that you have to be an organization admin. For more info about organizations, see: https://support.atlassian.com/organization-administration/docs/what-is-an-atlassian-organization/

Are you working within all of those requirements? If so, are there any API methods that you can call in the User Management APIs? (such as the GET/read operations)

Hi Neil,

Thanks for giving me the guideline.

I have a verified domain and i am the administrator. I have the connection accepted now. I can access (GET) the users information. I can enable user as well but when when I am trying to disable the user it return 400 error with following message:

{
    "key": "badRequestFormat",
    "context": {
        "message": "Invalid content type (application/octet-stream).  These are valid: application/json"
    },
    "errorKey": "bad-request-format",
    "errorDetail": {
        "message": "Invalid content type (application/octet-stream).  These are valid: application/json"
    }
}
Neil
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 12, 2021

@Arshadul Huq hmm.. so, according to the docs, that method doesn't require a body, nor a content-type for that matter; however, have you just tried setting the header Content-type to be application/json

I'd also check your Postman request to check the verb is DELETE and that there isn't any body content in the request.

Like Steffen Opel _Utoolity_ likes this

@Neil , Thank you for your help. Its working now.

Now the only issue is, how do i get {account_id} to 

Disable a user .

My scenario is, i have UserName/Email. How do i get the {account_id} from that.

Thank you for your cooperation.

Arshad.

Like Allan Maxwell likes this

@NeilAre we able to use this API via ScriptRunner? I am trying to create a script that will disable users once they leave the company.

Below is the code I'm using but its not working:

def disableUser(userId){
put("https://api.atlassian.com/users/${userId}/manage/lifecycle/disable")
.header("Content-Type", 'application/json')
.header("Authorization", "Bearer ${encode}")
.body()
.asString().body
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events