Am looking for an API that pulls the data from the whole workspace where an user is added as a reviewer to the PR and approved the PR
Hello and welcome to the Community @venukishorereddy_b
The closest workspace-level endpoint, /2.0/workspaces/{workspace}/pullrequests/{selected_user}, only returns pull requests authored by that user.
It does not return PRs where that user was a reviewer or approver. Atlassian also has an open suggestion for that exact gap
https://jira.atlassian.com/browse/BCLOUD-21950
Take look also here for some helpful Tips:
https://community.developer.atlassian.com/t/how-to-list-all-pr-where-a-specific-person-is-a-reviewer/82774
Any timeline on this
@venukishorereddy_b
We know as much as you. We working with Atlassian Tools, not For Atlassian.
There is no single Bitbucket Cloud API endpoint that directly returns all PRs approved by a specific user across a workspace. However, you can achieve this with the following approach:
1. Use the workspace pull requests endpoint to get all PRs for the workspace:
GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests
You will need to call this for each repository in the workspace, or use the workspace-level endpoint to list all repositories first.
2. Each PR object returned includes a "reviewers" array. You need to iterate through the results and filter for entries where the specific user appears in the reviewers array with their approval status set to "approved".
It looks like you're new here. Sign in or register to get started.