Reputation: 622
I'm having trouble merging a pull request via the 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
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. Few examples below.
Attempt 1:
{
"pullrequest_merge_parameters":
{
"close_source_branch":false,
"merge_strategy":"merge_commit",
"message":"Automatically merging pull request",
"type":""
}
}
Attempt 2:
{
"close_source_branch":false,
"merge_strategy":"merge_commit",
"message":"Automatically merging pull request",
"type":""
}
Attempt 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.
I've had no trouble with any other methods on the Bitbucket API.
Appreciate any and all help with this.
Upvotes: 1
Views: 1216
Reputation: 622
It turns out the API will return a bad request error if the pull request can't be merged due to conflicts.
As far as I can see this behavior is undocumented.
Upvotes: 1