All of our users are in confluence-users so that's a simplifying assumption we can use. I wrote a script to pull out all the users using <url>/rest/api/group<group name>/member and I certainly got a list.
To my chagrin I discovered that the list makes no distinction between Active and Inactive users. So I can then call the <url>/rest/api/user?username=<username> api to get more information, right?
But it doesn't tell me if the user is active or inactive, either!
From exploring these forums I gather that there is no better way (using the rest api) to get a list of users so my best hope is to find a way to determine if a user is active or inactive.
Is there a way to do that!?
I'm on Confluence Server if that makes a difference.
If you've already search and found no REST api to do it, you'll probably have to write your own REST api to expose that data.
There is a way to do this, sort of, without creating a new REST API.
First off, understand that there is no way to get USERS through the API: you can only get users in a group.
If you get the users from the confluence-users group that will probably be all the users on your system (this is true of our system).
The way you find out if this is true for you is to look in the global permission: <your_URL>/admin/permissions/globalpermissions.action. This will list the groups that have all the users who can actually do anything. There may be users on your system who are not in any of these groups but they have no access to anything (and they don't count against licensing).
My problem: some of the users in confluence-users were inactive so my final list included some inactive users. But inactive users have no business being in groups – they should be removed!
Once I removed them, the list of confluence-users IS the list of active users.
In summary: to get a list of users you need a group or a collection of groups that have all the users in it. Then you need to make sure that these groups have no inactive users. Then you can uses the <url>/rest/api/group<group name>/member API to get the users from those groups (be sure to remove any duplicates from the aggregated list) and it will be correct!
- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...
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