How to get Confluence User Status via Rest API

I would like to be able to find out if a particular user is activated or disabled in Confluence via the REST API (or some other similar method).  I can find how to get the details of users via the REST API (e.g. GET of http://example.com/rest/api/user?username=jblogs), but those details do not seem to return the status.  Is there something I can use in the "expand" property perhaps?

1 answer

1 accepted

If you have access to the database you can run a SQL query like:

select user_name, active from cwd_user where lower_user_name = 'admin';

The lower_user_name is the login username. The results should be something like this:Screen Shot 2017-06-14 at 3.31.30 PM.png

The T means the user is active.

 

Thanks for the response.  This is what I ended up having to do, along with an HTTP to SQL connector in order to access it from another internal website.

How to get access to the database for confluence? I need to do it from EXCEL VBA - is that possible if the admin grants me the rights? Do I need to install something?

What if we don't have access to the database to run queries? How can we find this user status information via API?

Ann Worley Atlassian Team Nov 22, 2017

I understand you can add &expand=status for example:

<Confluence_Base_URL>/rest/api/user?username=username&expand=status

 

Please let me know if this is what you are looking for.

Adding &expand=status to the end of the query string does not return anything about the user status. In fact, it doesn't return anything different than using <Confluence_Base_URL>/rest/api/user?username=username. We are using Confluence version 6.0.7 if that matters.

Ann Worley Atlassian Team Nov 27, 2017

I am sorry to hear that. I verified that &expand=status works with Confluence 6.5.1 and does not work on Confluence 6.0.7. Based on this, I don't think there is a way to get the user status using the REST API in Confluence 6.0.x.

Here is what was returned on 6.5.1:

{"type":"known","status":"deactivated","username":"charlie","userKey":"2c94a4c05ffe72d7015ffe742e860001","profilePicture":{"path":"/images/icons/profilepics/default.png","width":48,"height":48,"isDefault":true},"displayName":"Charlie","_links":{"base":"http://URL:8090","context":"","self":"http://URL:8090/rest/experimental/user?key=2c94a4c05ffe72d7015ffe742e860001"}} 

 Here is what I got on 6.0.7:

{"type":"known","username":"charlie","userKey":"2c94a4c05ffe56ac015ffe58f5eb0002","profilePicture":{"path":"/images/icons/profilepics/default.png","width":48,"height":48,"isDefault":true},"displayName":"Charlie of Atlassian","_links":{"base":"http://URL:8090","context":"","self":"http://URL:8090/rest/experimental/user?key=2c94a4c05ffe56ac015ffe58f5eb0002"}}

It looks like your options are to use the SQL queries or upgrade Confluence.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

381 views 21 10
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you