Manage Inactive Confluence Users REST API

Get Users (version 1.3.2 and later)

GET http://localhost:8090/rest/deactivateusers/1.0/reports/list/all/active/users

GET http://localhost:8090/rest/deactivateusers/1.0/reports/list/all/neverlogin/users

GET http://localhost:8090/rest/deactivateusers/1.0/reports/list/all/deactive/users

GET http://localhost:8090/rest/deactivateusers/1.0/reports/list/all/users

Query Parameters:

  • days (Number) - Days
    • Set 0 to get all the users.
  • type (Number)
    • 0 - Since
    • 1 - Before
  • group (String)

Response: [Status: 200]

$ curl -u confuser -XGET \
http://localhost:8090/rest/deactivateusers/1.0/reports/list/all/active/users?type=0&days=30&group=confluence-users


Update User Attributes (version 1.3.2 and later)

POST http://localhost:8090/rest/deactivateusers/1.0/utility/update/user/{username}

Path Parameters:

  • username (String) - Jira username

Query Parameters:

  • newEmail
  • newDisplayName
  • newUserName
  • addGroup (comma separated groups to add)

Response: [Status: 200]

$ curl -u superadmin -XPOST -H "Content-Type:application/json" \
"http://localhost:8090/rest/deactivateusers/1.0/utility/update/user/croadmin/? \
newEmail=croadmin@noreply.com"
{"status":1,"message":"[Info] Updated User attributes ~ croadmin"}
$



De-activate Users

DE-ACTIVATE USER

POST http://localhost:8090/rest/deactivateusers/1.0/utility/de-activate/user/{username}  (version 1.3.2 and later)

Path Parameters:

  • username (String) - Jira username

Response: [Status: 200]

$ curl -u"superadmin:superadmin" -XPOST -H "Content-Type:application/json" \
http://localhost:8090/rest/deactivateusers/1.0/utility/de-activate/user/croadmin
{"status":1,"message":"[Info] De-activated User - croadmin"}
$

DE-ACTIVATE USER (ADVANCE)

POST http://localhost:8090/rest/deactivateusers/1.0/utility/deactivate/user/{username}

Path Parameters:

  • username (String) - Jira username

Data Fields:

  • groups to remove e.g. ["group1", "group2"]

Response: [Status: 200]

$ curl -u"superadmin:superadmin" -XPOST -H "Content-Type:application/json" \
--data "['confluence-users']" \
http://localhost:8090/rest/deactivateusers/1.0/utility/deactivate/user/mamathavm4
{"status":1,"message":"[Info] De-activated User - mamathavm4"}
$



Re-activate Users

RE-ACTIVATE USER

POST http://localhost:8090/rest/deactivateusers/1.0/utility/re-activate/user/{username}  (version 1.3.2 and later)

Path Parameters:

  • username (String) - Jira username

Response: [Status: 200]

$ curl -u"superadmin:superadmin" -XPOST -H "Content-Type:application/json" \
http://localhost:8090/rest/deactivateusers/1.0/utility/reactivate/user/croadmin
{"status":1,"message":"[Info] Re-activated User - croadmin"}
$

RE-ACTIVATE USER (ADVANCE)

POST http://localhost:8090/rest/deactivateusers/1.0/utility/reactivate/user/{username}

Path Parameters:

  • username (String) - Jira username

Data Fields:

  • groups to add e.g. ["group1", "group2"]

Response: [Status: 200]

$ curl -u"superadmin:superadmin" -XPOST -H "Content-Type:application/json" \
--data "['confluence-users']" \
http://localhost:8090/rest/deactivateusers/1.0/utility/reactivate/user/mamathavm4
{"status":1,"message":"[Info] Re-activated User - mamathavm4"}
$

Note. It reverts rename prefix i.e. _inactive_ddmmyy


RUN USER DE-ACTIVATION FROM CLI

POST http://localhost:8090/rest/deactivateusers/1.0/utility/run/userdeactivation

Response: [Status: 200]

$ curl -u"user:password" -XPOST -H "Content-Type:application/json" \
http://localhost:8090/rest/deactivateusers/1.0/utility/run/userdeactivation 
{"status":0,"message":"Users Updated - 0/2. Took 0.178 Seconds"}
$

LEGACY RUN USER DE-ACTIVATION FROM CLI

POST http://localhost:8090/rest/deactivateusers/1.0/utility/legacyrun/userdeactivation

Response: [Status: 200]

$ curl -u"user:password" -XPOST -H "Content-Type:application/json" \
http://localhost:8090/rest/deactivateusers/1.0/utility/legacyrun/userdeactivation 
{"status":0,"message":"Users Updated - 0/2. Took 0.178 Seconds"}
$

Note:

  • This legacy user deactivation processes all the users in confluence (irrespective of directories) but remote directory as default configured processing directory.

REMOVE DEFINED GROUPS FOR USER

POST http://localhost:8090/rest/deactivateusers/1.0/utility/removegroups/user/{username}

Path Parameters:

  • username (String) - Jira username

Data Fields:

  • groups e.g. ["group1", "group2"]

Response: [Status: 200]

$ curl -u"user:password" -XPOST -H "Content-Type:application/json" \
--data "['confluence-users']" \
http://localhost:8090/rest/deactivateusers/1.0/utility/removegroups/user/croadmin
{"status":1,"message":"[Info] Removed User Groups."}
$

REMOVE ALL GROUPS FOR USER

POST http://localhost:8090/rest/deactivateusers/1.0/utility/removeallgroups/user/{username}

Path Parameters:

  • username (String) - Jira username

Response: [Status: 200]

$ curl -u"user:password" -XPOST -H "Content-Type:application/json" \
http://localhost:8090/rest/deactivateusers/1.0/utility/removeallgroups/user/croadmin
{"status":1,"message":"[Info] Removed User Groups."}
$

GET ACTIVE USERS NEVER LOGIN CREATED BEFORE N DAYS

GET http://localhost:8090/rest/deactivateusers/1.0/utility/list/neverlogin/users/create/before/{days}

Path Parameters:

  • days (Number) - Days

Response: [Status: 200]

$ curl -u"user:password" -XGET \
http://localhost:8090/rest/deactivateusers/1.0/utility/list/neverlogin/users/create/before/60
["kumadmin","swethap"]
$

GET ACTIVE USERS NOT ACTIVE LAST N DAYS

GET http://localhost:8090/rest/deactivateusers/1.0/utility/list/notactive/users/last/{days}

Path Parameters:

  • days (Number) - Days

Response: [Status: 200]

$ curl -u"user:password" -XGET \
http://localhost:8090/rest/deactivateusers/1.0/utility/list/notactive/users/last/60
["croadmin","superadmin"]
$

GET DE-ACTIVATED USERS

GET http://localhost:8090/rest/deactivateusers/1.0/utility/list/deactiveusers

Response: [Status: 200]

$ curl -u"user:password" -XGET \
http://localhost:8090/rest/deactivateusers/1.0/utility/list/deactiveusers
["cro","thaikkp"]
$