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

How to get all the pull request for any User using REST api

Deleted user March 13, 2020

Hello,

 

I am trying to create a simple dashboard for our organization which shows the logged-in user the tasks which are open in their plate.  Below is an overview of what I am trying to do.

Screenshot from 2020-03-13 23-09-00.png

 

Question :

We are using the On-Premise Bitbucket server.

Is there a way to get all the PR's based on 'name' or 'email Id' using REST apis?

I looked into https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html, but couldn't find a way to solve my problem.

 

Any help will be greatly appreciated.

 

Thanks in advance,

Supreeth

 

 

 

2 answers

1 vote
Uladzislava Kastsitsyna _Stiltsoft_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 8, 2023

Hi!

One of the ways to get all the PR's based on a username is by using the app called Awesome Graphs for Bitbucket. It allows you to export commit or pull request data into a CSV file or via REST API on the global, project, repository, or user level.

Kind regards,
Uladzislava

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2020

It is possible, but you have to get all the pull requests and then sort them based on the user. You can use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests to get your pull requests and then /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId} to get each individual PR. Look for author in the returned response.

Deleted user March 13, 2020

@Mikael Sandberg Thanks a lot for the quick reply.

 

I have tried this endpoint.

But currently, our organization has 19 projects and in total 227 repositories and this number is bound to increase over time.

 

Since I am building a dashboard and expecting the data in real-time, iterating on all these repos is not a feasible solution.

 

Do you know any other way to narrow down the search?

 

Thanks and regards,

Supreeth 

Maciej Adamczak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 17, 2020

Hey @[deleted] you can try using the `/rest/api/1.0/dashboard/pull-requests` resource to get all the pull requests for the current logged in user:
https://docs.atlassian.com/bitbucket-server/rest/7.0.1/bitbucket-rest.html#idp90

 

Thanks,
Maciej

J_ E_ August 25, 2020

Hi @Maciej Adamczak - is there any way to get the dashboard for another user?  For example, if you are a project manager and you want to be able to see all of the Pull Requests of the people on your team.

I also tried to see if the all-pull-requests had a REST API (as that should hopefully speed up @Mikael Sandberg 's suggestion) but I can't find any docs about a REST API for tht plugin.

Maciej Adamczak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2020

@J_ E_ Unfortunately Bitbucket doesn't have a REST endpoint that works with all the pull requests. The only supported REST API is the one for a repository pull requests: https://docs.atlassian.com/bitbucket-server/rest/7.5.0/bitbucket-rest.html#idp291

As for accessing a dashboard of another user, Bitbucket doesn't have this feature either.

Thanks,

Maciej Adamczak
Bitbucket Developer

Eric Smith September 4, 2020

I'm interested in this as well. Basically I'm looking for a rest call that lists all the PRs on the page: /plugins/servlet/all-pull-requests/all?state=open

We're in a similar situation with lots of projects and repos. Individually requesting PRs in each repo is not practical.

 

It's possible to parse the above page and get what I want, but that will be very hacky and error prone

 

@[deleted] did you find a solution for this?

 

Thanks,

Eric Smith

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events