I'm struggling to figure out how to create a pull request with autocomplete enabled with using the API if someone can provide an example of the JSON posted to enable the autocomplete that would be awesome.
I've tried setting the autoCompleteSetBy Property and also have tried a whole bunch of settings within  completionOptions Property as well.
You can't create a Pull Request with autocomplete enabled when you use the Create PR rest API. you can only update a current PR with autocomplete enabled with the Pull Requests - Update, so you need to create the PR, take the new ID and then update it.
The basic body is to specify the autoCompleteSetBy with the ID of the user who actually runs the API:
"autoCompleteSetBy":  {
                          "id":  "dsafasf-41531tf-safsaf-24124fas-sfasfasf"
                      }
You can also add additional parameters with completionOptions like squash merge and more, see here.
If you want to automate of creating Pull Requests process you can install the Create Pull Request extension.
The easiest way is to first create the PR with the desired settings, and then issue an update using the value of the CreatedBy property to set the value of the AutoCompleteSetBy property.
If you haven't specified a merge strategy upon PR creation, make sure to set it when updating. Otherwise you will run into an exception.
private static GitPullRequest AutoCompletePullRequest(GitPullRequest existingPullRequest) => new()
{
    AutoCompleteSetBy = existingPullRequest.CreatedBy,
    CompletionOptions = new GitPullRequestCompletionOptions
    {
        MergeStrategy = GitPullRequestMergeStrategy.Squash
    }
};
followed by a call to UpdatePullRequestAsync()
var pullRequestUpdate = AutoCompletePullRequest(createdPr);
await gitClient.UpdatePullRequestAsync(
            pullRequestUpdate,
            repository.Id,
            createdPr.PullRequestId,
            cancellationToken: cancellationToken);
Taken from: https://developercommunity.visualstudio.com/t/how-to-get-identityref-for-the-current-user-or-arb/1129979
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With