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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

 

 

 

1 answer

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.

@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 

Hey @supreeth 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

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.

@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

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

 

@supreeth did you find a solution for this?

 

Thanks,

Eric Smith

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

441 views 4 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you