How can I get a collection of all users within an organization?

bitbucket-cloud
rest-api

#1

My real-world end-goal is to get all the emails, IDs, and display names of all Bitbucket users in an organization (note: not a Bitbucket team).

There is no /users endpoint.

Given the above the only way I could see doing this is by querying each repository for a list of user accounts with at least read access.

Is there a mechanism for getting the data I want?


#2

@taryn There isn’t actually a concept of organization within Bitbucket Cloud.


#3

Not technically, no, but organizations of humans certainly think of themselves this way.

Is there any way to get all users with read access / member role for a given repository?

I could use that to do what I want here.


#4

@taryn what is it that you’re trying to accomplish? right now, we don’t have any non-deprecated APIs to accomplish this.


#5

The service I am building performs scheduled tasks with user and repository PR data.

One such example is creating a mapping from Bitbucket users to Slack users.

I would like to do as much of this one time “up-front” (ideally when granted access via the Auth2 flow) instead of every time the scheduled task runs.

The reason I’ve asked my question the way I have is that my service works with potentially N repos with M Bitbucket users.

Repo A may have PRs with user 1, 2, and 3 assigned as reviewers, and another PR with 1, 2, and 5.
At the same time Repo B may have a PR with users 2, 8, and 12.

I want to map all of these users (employees, contractors, etc. doesn’t matter to me as long as they have access and are active) to Slack users so that I can send them direct messages when certain events occur.

Bitbucket and Slack aren’t the only systems involved but hopefully this explains why I want this data.


#6

Is there perhaps a way to get a bitbucket user by email?
This is one route I could go, though I was hoping to make the account association that I’m building be as automagic as possible, and of course if this functionality exists in the API it could be used for spamming so I assume it doesn’t exist.