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

bitbucket rest api get PRs of particular branch

Abbas Mohammed April 27, 2023

Trying to fetch all the PRs merged to develop branch using bitbucket api.  But it is fetching all the PR of other branches also.

Want to fetch PRs of particular branch say "develop" or "release"

 

https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo>/pullrequests/?at=develop

 

Tried with 

https://api.bitbucket.org/2.0/repositories/workspace-id/repo/pullrequests/?

destination.branch.name=develop
Both ways it is fetching PRs of other branches too.

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2023

Hi @Abbas Mohammed and welcome to the community!

You can try with a query as follows:

https://api.bitbucket.org/2.0/repositories/workspace-id/repo/pullrequests?q=(destination.branch.name="develop")

Certain characters in the query may need URL encoding, and with URL encoding it will look as follows:

https://api.bitbucket.org/2.0/repositories/workspace-id/repo/pullrequests?q=%28destination.branch.name%3D%22develop%22%29

Does this work for you?

Just a heads up, I removed the workspace id and repo name from your post to protect your privacy.

Kind regards,
Theodora

Abbas Mohammed May 1, 2023

Thanks @Theodora Boudale  it is working as expected.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2023

You are very welcome, please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events