Missed Team ’24? Catch up on announcements here.

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

Bitbucket cloud issues with API to un approving pull requests

Robert Pavlovskiy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 18, 2024

Hello. I'm writing  app to unapprove all approved pull request when new commits are pushed to the pull request's source branch, or the pull request is updated to target a different branch.

When I make an API request to 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve'. I am facing two cases:
1. I have a pull request approved through the UI by myself(I'm participant), and when I try to unapprove this pull request through the API request, I am faced with the fact that the request is success , but the change is not displayed on the UI.
2. I have a pull request  approved through the UI, and when I try to unapprove through the request API, I encounter the following response
{
"type": "error",
"error": {
"message": "You haven't approved this pull request."
}
}

What can this be connected with and how to solve it?
Thank you.

1 answer

1 vote
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2024

@Robert Pavlovskiy

The approve/unapprove API, perform on behalf of the authenticated user. i.e. You can't approve for a different user.

Assuming you are using connect with a team workspace, the user is going to be the app user, not you.

To perform it as you, you can use app passwords.

Robert Pavlovskiy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 19, 2024

Thanks

Suggest an answer

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

Atlassian Community Events