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.
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.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.