通过API合并Bitbucket拉取请求

时间:2018-10-30 15:32:27

标签: bitbucket bitbucket-server bitbucket-api

根据Bitbucket API documentation,我应该能够将带有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作为版本号,完全省略版本号-结果始终相同。如何合并?

2 个答案:

答案 0 :(得分:0)

version的值应该是here记录的GET请求的响应中的值

此外,您可以通过对GET端点进行merge request来检查是否可以合并拉取请求

答案 1 :(得分:0)

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

https://.../merge?version

正确的格式是

https://.../merge?version=<version>
相关问题