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!
Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time! We're looking for people to participate in a remote 1-hr workshop...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs