0
votes

Is there a way to queue a (XAML) build on TFS with a specific changeset via the REST API?

I already tried this, which queues the build but uses the latest changeset. Not the one I specified.

POST https://{instance}/DefaultCollection/{project}/_apis/build/builds?api-version={version}
{
    "definition": {
        "id": 28
    },
    "sourceBranch": "$/xxxx/xxxx",
    "SourceVersion": "Cxxxx",
}

I found this solution here: How to correctly pass variables & source version to API 2.0 VNext Build in TFS 2015

But it is for TFS 2015 and vNext builds. What I'm looking for is 2017 and XAML.

1

1 Answers

0
votes

We can not queue a XAML build with a specific changeset via the REST API.

If you want to queue a Xaml build with the specific changeset, then you can edit the build definition and specify the specific changeset in Get Version (Reference below screenshot).

Besides, the REST API you mentioned (Build (2.0)) is for VNext build although it works when specify the build definition ID.

In general, for Xaml build, you can use request a build with below REST API (See Request a build):

POST https://{instance}/DefaultCollection/{project}/_apis/build/requests?api-version={version}

Content-Type: application/json

{
    "definition": {
        "id": 4
    },
    "reason": "manual",
    "priority": "Normal",
}

enter image description here