Last Update: 12/5/2016
For the latest Build REST APIs, see Build (2.0)

Build definitions

api-version = 1.0

If you haven't already, look at the information on getting started with these APIs.

Get a list of build definitions

GET https://{instance}/DefaultCollection/{project}/_apis/build/definitions?api-version={version}[&projectName={string}]
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Team project ID or name.
Query
api-version string Version of the API to use.
projectName string Name of the team project that contains the build definitions.
Wildcards (*) are supported.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/definitions?api-version=1.0

Sample response

Status code: 200
{
  "value": [
    {
      "batchSize": 1,
      "uri": "vstfs:///Build/Definition/2",
      "queue": {
        "queueType": "buildController",
        "id": 274,
        "name": "Hosted Build Controller",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/build/Queues/274"
      },
      "triggerType": "continuousIntegration",
      "defaultDropLocation": "#/",
      "buildArgs": "",
      "dateCreated": "2014-03-13T16:29:21Z",
      "supportedReasons": 63,
      "lastBuild": {
        "id": 348,
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/348"
      },
      "definitionType": "xaml",
      "id": 2,
      "name": "MyWebSite CI",
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/2"
    },
    {
      "batchSize": 1,
      "uri": "vstfs:///Build/Definition/3",
      "queue": {
        "queueType": "buildController",
        "id": 274,
        "name": "Hosted Build Controller",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/build/Queues/274"
      },
      "triggerType": "continuousIntegration",
      "defaultDropLocation": "#/",
      "buildArgs": "",
      "dateCreated": "2014-03-27T19:41:43.323Z",
      "supportedReasons": 63,
      "lastBuild": {
        "id": 335,
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/335"
      },
      "definitionType": "xaml",
      "id": 3,
      "name": "CustomerAddressModule",
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/3"
    }
  ],
  "count": 2
}

Get a build definition

GET https://{instance}/DefaultCollection/{project}/_apis/build/definitions/{definitionId}?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Team project ID or name.
definitionId int ID of the build definition.
Query
api-version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/definitions/3?api-version=1.0

Sample response

Status code: 200
{
  "batchSize": 1,
  "uri": "vstfs:///Build/Definition/3",
  "queue": {
    "queueType": "buildController",
    "id": 274,
    "name": "Hosted Build Controller",
    "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/build/Queues/274"
  },
  "triggerType": "continuousIntegration",
  "defaultDropLocation": "#/",
  "buildArgs": "",
  "dateCreated": "2014-03-27T19:41:43.323Z",
  "supportedReasons": 63,
  "lastBuild": {
    "id": 335,
    "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/335"
  },
  "definitionType": "xaml",
  "id": 3,
  "name": "CustomerAddressModule",
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/3"
}