Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stash, rest, number of active users

Mike Wlodarczyk February 13, 2013

Hi,

when I want a number of projects, I may use: /rest/api/1.0/projects?limit=1000

but now, I should receive number of active users - how i may do it ?

Is '/rest/api/1.0/users' returning active users ?

thanks, Mike

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2013

Hi Mike,

This REST end-point:

GET /rest/api/1.0/admin/permissions/users

will return users who have explicitly been granted a global permission (which means that they are licensed). And:

GET /rest/api/1.0/admin/permissions/groups

will similarly return groups who have explicitly been granted a global permission.

However neither will return users that inherit their permissions from a group. To determine the set of all users that are licensed you'd need to use the iterate through the groups returned by the /permissions/groups end-point and retrieve their members, using:

GET /rest/api/1.0/admin/groups/more-members?context=<group_name>

That said, there is an easier way. I put together a small plugin for tracing user permissions working on a support case a little while back. It's open source and available from:

https://bitbucket.org/tpettersen/user-permission-debugger

This plugin will return a plain text list of all users that have been granted a particular permission. There are some instructions for installation here:

https://confluence.atlassian.com/display/STASHKB/Determine+the+users+that+currently+occupy+Stash+license+seats

Hope this helps!

cheers,

Tim

TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2013

By-the-by, full documentation for our REST API is available here: https://developer.atlassian.com/static/rest/stash/latest/stash-rest.html

Mike Wlodarczyk February 24, 2013

thanks ! :)

/rest/api/1.0/admin/permissions/users - it works great :)

Mike Wlodarczyk February 24, 2013

thanks :) !

GET /rest/api/1.0/admin/groups/more-members?context=<group_name> - it wors great :)

1 vote
Ujjwal Kabra September 3, 2015

Hi,

Just wanted to add an update to this answer for others who have this issue, perhaps a change in recent versions of the stash REST API.

GET /rest/api/1.0/users?permission=LICENSED_USER[&limit=xxx]

is a good way to get all the users occupying licensed seats.

I wasn't able to find this in the documentation, but found it through trial-and-error in the REST API Browser.

1 vote
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2013

Hey Mike,

That REST resource you mentioned should return all of the non-deleted users in Stash. Is that what you mean by 'active'?

What results are you seeing? Perhaps more importantly what are you looking to do with Stash?

Cheers,

Charles

Mike Wlodarczyk February 22, 2013

so, in my situation the active users - it's the users who have license to stash.

this query: '/rest/api/1.0/users' returns all users (even users who no have license)

How I may receive users who have license to stash (in rest query - I develop application in java, which counting statistics from stash) ?

TAGS
AUG Leaders

Atlassian Community Events