Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateRepositoryPullRequestAsync failed because of status code 400 #9

Closed
woodylic opened this issue Sep 15, 2020 · 1 comment
Closed

Comments

@woodylic
Copy link

Code:

var pr = await client.CreateRepositoryPullRequestAsync(workspaceId, repositorySlug,
        new PullRequestCreationParameters
        {
            Title = $"Auto-merge for release {version} completion.",
            Source = new HasName { Name = releaseBranch },
            Destination = new HasName { Name = "develop" }
        }).ConfigureAwait(false);

Error:

Unhandled exception. Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST https://api.bitbucket.org/2.0/repositories/english1/auth2/pullrequests

According to the API document (link), the expected request body is

{
    "title": "My Title",
    "source": {
        "branch": {
            "name": "my-feature-branch"
        }
    },
    "destination": {
        "branch": {
            "name": "staging"
        }
    }
}

The actual request body is

{
  "title": "My Title",
  "source": {
    "name": "my-feature-branch"
  },
  "destination": {
    "name": "staging"
  }
}

Furthermore, PullRequestCreationParameters requests Reviewer but it is not used when sending the REST request.

@lvermeulen
Copy link
Owner

Thanks for reporting this, @woodylic ! Fix is in the next release.

lvermeulen added a commit that referenced this issue Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants