Reputation: 57316
According to Bitbucket API documentation, I should be able to merge a pull request with POST to this url:
https://bitbucket.example.com/rest/api/1.0/projects/{projectkey}/repos/{repositoryslug}/pull-requests/{pullrequestid}/merge?version
Yet, whenever I try it, I receive response 409 Conflict
and in the response, it contains this:
"message": "You are attempting to modify a pull request based on out-of-date information.",
"currentVersion": 0,
"expectedVersion": -1,
I tried passing 0
as the version number, -1
as the version number, omit version number altogether - the result is always the same. How can I get it to merge?
Upvotes: 3
Views: 9671
Reputation: 57316
As it turns out, atlassian API documentation was a bit wrong (or unclear). I was doing everything correctly, but the version number needs to be passed differently. According to the docs, the format is
https://.../merge?version
Whereas the correct format is
https://.../merge?version=<version>
Upvotes: 7