It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is any API can revoke user's access? Edited

Hi, I read the document and didn't find the related API to make revoke users.

just can remove the group to make user can't access.

 

I want to make this disable by API. Is any API can do that?

螢幕快照 2019-10-02 12.21.08.png

1 answer

0 votes
Dario Atlassian Team Oct 03, 2019

Hi @eric_kao ,

Is this for Jira Server or Cloud?

In Jira Server you can activate/deactivate a user by sending a PUT request to the /rest/api/2/user endpoint. For details see: 

 

In Jira Cloud it is not possible to use above endpoint but, having claimed a domain, you can use the User Management REST API to disable a user by sending a POST request to the /users/{account_id}/manage/lifecycle/disable endpoint. For details see:

 

I hope this helps.

 

Cheers,
Dario

Hi @Dario

Now, we used Jira Cloud and this api is the version2.

But now is version3. I will try the User Management REST API to do this.

 

Thanks.

 

Regards,

Eric

Like Dario likes this
Dario Atlassian Team Oct 03, 2019

Thanks @eric_kao ,

Let us know how it goes, or just accept the answer if this helps 

Hi @Dario ,

Are there any example code about disable users?

I have tried to use the User Management REST API but still can't disable users.

Hi @eric_kao ,

Examples showing how to disable users via REST API using cURL, Node.js, Java, Python and PHP are available in the documentation page itself:

sample-code.jpg

 

When sending the request, kindly make sure that:

  1. You are trying to disable a managed account for the organization you are set as an administrator (ht****e).
  2. You are setting in the endpoint URL the correct AccountID for the user you want to disable
  3. You are using a valid API Key to authenticate the REST API call

 

 

If this still doesn't work, please try to send the request using Curl as shown in below example and paste the result in your answer (make sure to remove the sensitive content):

curl -D- -H 'Authorization: Bearer <ADMIN API KEY HERE>' -H 'Content-Type: application/json' -d '{ "message": "SOME MESSAGE"}' -X POST https://api.atlassian.com/users/<ACCOUNT ID TO DISABLE>/manage/lifecycle/disable

 

Cheers,
Dario

Hi @Dario ,

I would like to manage with API requests the revoke/grant access for customers created in Jira Service Desk (Cloud) with :

curl --request POST \
  --url 'https://your-domain.atlassian.net/rest/servicedeskapi/customer' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "displayName": "Fred F. User",
  "email": "fred@example.com"
}'


My role is site admin, is there a way to do this ?

When I'm using the "Disable user" request I get error 401 unauthorized.


Thanks for your answer,
Cheers,

Anne

 

EDIT : I post the question here.

 

 

Hi @Anne Morel ,

The REST API endpoint provided in here is only intended to be used with  managed accounts for the organization you are set as an administrator for (if any), and it is not intended to be used to disable portal only (Jira Service Desk) customers.

 

However, in order to avoid mixing different topics, I will reply adding more details in the other thread.

 

@eric_kao , did the answer help? Can you kindly accept it in case it was useful? 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you