How to get Confluence User Status via Rest API

Jonathan Klapel June 5, 2017

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

0 votes
Answer accepted
AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 14, 2017

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.

 

Jonathan Klapel June 14, 2017

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.

Peter Bunde Hansen July 12, 2017

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?

SEI Information Technology November 20, 2017

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

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 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.

SEI Information Technology November 27, 2017

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.

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 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
TAGS
AUG Leaders

Atlassian Community Events