• 856
    • 34
    • Hide
      Atlassian Update – 22 July 2019

      Hi everyone,

      Jira API for disabling users is now available in Jira 8.3 released today. You can download 8.3 here or read more in the release notes.

      Katarzyna Derenda
      Senior Product Manager, Jira Server and Data Center

      Show
      Atlassian Update – 22 July 2019 Hi everyone, Jira API for disabling users is now available in Jira 8.3 released today. You can download 8.3  here or read more in the release notes . Katarzyna Derenda Senior Product Manager, Jira Server and Data Center
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      Problem Definition

      It is very nice to be able to create new users via the API so that you can easily handle new hire employees, but the same should be true for employees that leave.

      Suggested Solution

      It would be good to be able to disable them via the API as well. For larger companies with lots of churn this can be very useful.

      Currently when trying to disable a bunch of old users via the API using the /rest/api/2/user endpoint via PUT:

      { "username": "abbasm", "active": false }

      Returns:
      {
      "errorMessages": [
      "error.no.value.found.to.be.changed"
      ],
      "errors": {}
      }

      Workarounds

      Please check Atlassian Answers Disabling multiple users in bulk - using REST for possible workarounds.

            [JRASERVER-44801] JIRA API disabling users

            CHILUMKURU added a comment - - edited

            Hi Team,

            Can anyone please comment on my request.

            I am looking for an article to bulk deactivate only Jira users using REST API for cloud based platform and other product access like Confluence, BitBucket, etc. should not be impacted, if user having multiple Atlassian product access as highlighted in Orange.

            CHILUMKURU added a comment - - edited Hi Team, Can anyone please comment on my request. I am looking for an article to bulk deactivate only Jira users using REST API for cloud based platform and other product access like Confluence, BitBucket, etc. should not be impacted, if user having multiple Atlassian product access as highlighted in Orange.

            CHILUMKURU added a comment -

            Hi @Pedro Souza,

            Thanks for sharing the article but it is only applicable for Data Centre platform.

            I am looking for cloud based platform and not sure if any article to bulk deactivate only Jira users and other product access like Confluence, BitBucket, etc. should be remain unchanged.

            Thanks for your response.

            CHILUMKURU added a comment - Hi @Pedro Souza, Thanks for sharing the article but it is only applicable for Data Centre platform. I am looking for cloud based platform and not sure if any article to bulk deactivate only Jira users and other product access like Confluence, BitBucket, etc. should be remain unchanged. Thanks for your response.

            Pedro Souza added a comment - - edited

            There are a few usage examples of this endpoint in the article:
            https://confluence.atlassian.com/display/JIRAKB/Bulk+Disable+Jira+Users

            You may try the bash command, it makes it easy to bulk disable users from a txt list of usernames.

            Pedro Souza added a comment - - edited There are a few usage examples of this endpoint in the article: https://confluence.atlassian.com/display/JIRAKB/Bulk+Disable+Jira+Users You may try the bash command, it makes it easy to bulk disable users from a txt list of usernames.

            Hi Katarzyna or anyone elase , could you point me to the section in the 8.3 release notes or other doc which talks more about disabling users in bulk via API?    If there is a better place to ask this I can do that.

            Thanks,

            Vinnie

             

             

            Vinnie Chhabra added a comment - Hi Katarzyna or anyone elase , could you point me to the section in the 8.3 release notes or other doc which talks more about disabling users in bulk via API?    If there is a better place to ask this I can do that. Thanks, Vinnie    

            I send `PUT` request to `/rest/api/2/user?username=xxx`, but it return me `405 Method Not Allowed`.

            How I can activate/deactivate user via API?

            Александр Павлов added a comment - I send `PUT` request to `/rest/api/2/user?username=xxx`, but it return me `405 Method Not Allowed`. How I can activate/deactivate user via API?

            gael added a comment -

            Okya,

             

            sorry to disturb here. But I found my problem. It works with this path "rest/api/2/user?username=admin" but not with "rest/api/2/user"

            gael added a comment - Okya,   sorry to disturb here. But I found my problem. It works with this path "rest/api/2/user?username=admin" but not with "rest/api/2/user"

            I think that this discussion should be moved to the Atlassian forums.

            Amir Katz (Outseer) added a comment - I think that this discussion should be moved to the Atlassian forums.

            gael added a comment -

            Hi Everynone,

             

            I tried the same thing as you did but it does not work for me. I'm using Ansible to call the RESt API. Here is what I'm doing:
            - name: Post Config JIRA - Disable Local Admin account
            uri:
            url: "https://xxxx/rest/api/2/user"
            method: PUT
            status_code: 200
            headers:
            Content-Type: application/json
            Cache-control: no-cache
            Authorization: Basic xxxxx
            body_format: json
            body:
            username: "admin"
            displayName: "XXXX"
            emailAddress: "xxx@xxxx"
            active: "false"
             
            I get this message:
             
            fatal: [localhost]: FAILED! => {"cache_control": "no-cache, no-store, no-transform", "changed": false, "connection": "close", "content": "{\"errorMessages\":[\"Either the 'username' or the 'key' query parameters need to be provided\"],\"errors\":{}}"
             
            I'm providing the username as it says in the message but it's not working...
             
            Could you help me ?
             

            gael added a comment - Hi Everynone,   I tried the same thing as you did but it does not work for me. I'm using Ansible to call the RESt API. Here is what I'm doing: - name : Post Config JIRA - Disable Local Admin account uri : url : "https://xxxx/rest/api/2/user" method : PUT status_code : 200 headers : Content-Type : application/json Cache-control : no-cache Authorization : Basic xxxxx body_format : json body : username : "admin" displayName: "XXXX " emailAddress : "xxx@xxxx" active : "false"   I get this message:   fatal: [localhost] : FAILED! => {"cache_control": "no-cache, no-store, no-transform", "changed": false, "connection": "close", "content": "{\"errorMessages\": [\"Either the 'username' or the 'key' query parameters need to be provided\"] ,\"errors\":{}}"   I'm providing the username as it says in the message but it's not working...   Could you help me ?  

            Update: I was mistaken - it needs to be a PUT and not a POST. Works like a charm!

             

            Kamran Ansari added a comment - Update: I was mistaken - it needs to be a PUT and not a POST. Works like a charm!  

            Kamran Ansari added a comment - - edited

            Has anyone tried this yet? I upgraded to 8.3.0 today, all excited that this feature is finally available, but it doesn't seem to work for me. I'm sure it's something that I'm doing wrong here, so I thought I'd ask here before filing a bug.

            Here's what I am trying to accomplish: I have a user who is currently enabled and I'd like to disable them using REST API.

            Endpoint: /rest/api/2/user

            Request type: POST

            Body:

            {    "name": "testuser1234",    "active":"false",    "emailAddress":"inactive_testuser1234@mycompany.com",    "displayName":"Test User" }

            Response I get:

            {
                 "errorMessages": [],
                 "errors":

            {           "username": "A user with that username already exists."        }

            }

            Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/user-updateUser

             

            Edit: I do have sys. admin permissions.

             

            Kamran Ansari added a comment - - edited Has anyone tried this yet? I upgraded to 8.3.0 today, all excited that this feature is finally available, but it doesn't seem to work for me. I'm sure it's something that I'm doing wrong here, so I thought I'd ask here before filing a bug. Here's what I am trying to accomplish: I have a user who is currently enabled and I'd like to disable them using REST API. Endpoint: /rest/api/2/user Request type: POST Body: {    "name": "testuser1234",    "active":"false",    "emailAddress":"inactive_testuser1234@mycompany.com",    "displayName":"Test User" } Response I get: {      "errorMessages": [],      "errors": {           "username": "A user with that username already exists."        } } Reference:  https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/user-updateUser   Edit: I do have sys. admin permissions.  

              mmasiorski Marcin Masiorski (Inactive)
              kgrier kitkat (Inactive)
              Votes:
              262 Vote for this issue
              Watchers:
              154 Start watching this issue

                Created:
                Updated:
                Resolved: