首页 > 解决方案 > 通过 API 合并 bitbucket 拉取请求

问题描述

根据Bitbucket API 文档,我应该能够将拉取请求与 POST 合并到此 url:

https://bitbucket.example.com/rest/api/1.0/projects/{projectkey}/repos/{repositoryslug}/pull-requests/{pullrequestid}/merge?version

然而,每当我尝试它时,我都会收到响应409 Conflict,并且在响应中,它包含以下内容:

"message": "You are attempting to modify a pull request based on out-of-date information.",
"currentVersion": 0,
"expectedVersion": -1,

0我尝试作为版本号传递,-1作为版本号,完全省略版本号 - 结果总是一样的。我怎样才能让它合并?

标签: bitbucketbitbucket-serverbitbucket-api

解决方案


事实证明,atlassian API 文档有点错误(或不清楚)。我做的一切都是正确的,但是版本号需要以不同的方式传递。根据文档,格式是

https://.../merge?version

而正确的格式是

https://.../merge?version=<version>

推荐阅读