API: Re-approving a pull request via REST doesn't work: "You already approved this pull request"

Issue #14732 resolved
Robin Stocker staff created an issue

How to reproduce:

  1. In a repository for a premium account, enable "Reset approvals when the source branch is modified" in the repository's branch permission settings
  2. Create a PR and approve it (either in UI or through API)
  3. Add a new commit to the PR. This resets the approval status because the approval was for an older commit.

Then, try to approve the PR through the API again:

curl -X POST -u ... \
https://api.bitbucket.org/2.0/repositories/atlassian/test/pullrequests/1/approve

Expected: PR is approved again.

Actual: The call fails:

{"type": "error", "error": {"message": "You already approved this pull request."}}

Workaround

It's possible to work around this problem until it is fixed by doing the following two requests instead (the first one removes the original approval):

curl -X DELETE -u ... https://api.bitbucket.org/2.0/repositories/atlassian/test/pullrequests/1/approve
curl -X POST -u ... https://api.bitbucket.org/2.0/repositories/atlassian/test/pullrequests/1/approve

Comments (2)

  1. Log in to comment