简体   繁体   English

将拉取请求与 Bitbucket API 2.0 合并时出现错误请求

[英]Bad request when merging pull request with Bitbucket API 2.0

I'm having trouble merging a pull request via the Bitbucket API 2.0.我在通过 Bitbucket API 2.0 合并拉取请求时遇到问题。 I just get a bad request error every time.我每次都会收到错误的请求错误。

Building my request based on spec here: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/merge根据此处的规范构建我的请求: https : //developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/merge

URL I'm using is:我使用的网址是:

https://api.bitbucket.org/2.0/repositories/xxxx/xxxx/pullrequests/100/merge

I've tried various different formats for the JSON body but nothing is working.我为 JSON 主体尝试了各种不同的格式,但没有任何效果。 Few examples below.下面举几个例子。

Attempt 1:尝试 1:

{
    "pullrequest_merge_parameters":
    {
        "close_source_branch":false,
        "merge_strategy":"merge_commit",
        "message":"Automatically merging pull request",
        "type":""
   }
}

Attempt 2:尝试 2:

{
    "close_source_branch":false,
    "merge_strategy":"merge_commit",
    "message":"Automatically merging pull request",
    "type":""
}

Attempt 3:尝试 3:

{
    "merge_strategy":"merge_commit",
    "message":"Automatically merging pull request",
}

Also tried with various combinations of the individual parameters and with no body.还尝试了各个参数的各种组合并且没有主体。 Everything results in 400 bad Request.一切都会导致 400 个错误的请求。

I've had no trouble with any other methods on the Bitbucket API.我对 Bitbucket API 上的任何其他方法都没有遇到任何问题。

Appreciate any and all help with this.感谢您对此的任何帮助。

It turns out the API will return a bad request error if the pull request can't be merged due to conflicts.事实证明,如果由于冲突无法合并拉取请求,API 将返回错误请求错误。

As far as I can see this behavior is undocumented.据我所知,这种行为是无证的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM